Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Table of Contents should respect "raw" HTML tags #353

Closed
linkdotnet opened this issue Oct 15, 2024 · 4 comments
Closed

Table of Contents should respect "raw" HTML tags #353

linkdotnet opened this issue Oct 15, 2024 · 4 comments
Labels
enhancement New feature or request

Comments

@linkdotnet
Copy link
Owner

linkdotnet commented Oct 15, 2024

Currently, only markdown is parsed, but <h2...> and friends should also work.

While working on this feature, there are some major complexity points here: mainly:

Do we want to allow a mixed mode? So there are # in the code and <h1> and friends.

Markdig doesn't support parsing HTML elements out of the box - therefore, we might need to use something like Anglesharp to parse the HTML itself.

For the time being, keeping the HTML Toc (if there is one) might be the easier solution.

@linkdotnet linkdotnet added bug Something isn't working enhancement New feature or request and removed bug Something isn't working labels Oct 15, 2024
@linkdotnet
Copy link
Owner Author

An alternative is something like: https://github.com/mysticmind/reversemarkdown-net

We could offer a button that just converts all the HTML to markdown. That would also solve the problem.

@FrancescoRepo
Copy link
Contributor

Hi @linkdotnet,
I'm available to work on this feature to add the button to convert HTML to markdown using the library you mentioned: https://github.com/mysticmind/reversemarkdown-net
This button should convert all the HTML to markdown and also give the possibility to restore the original content in case the user wants to go back.

I was also thinking, not totally related to this feature, but to add a "Preview" button near the "Submit" button when you create the post to show what it'll look like in a full-screen modal. This, of course, means refactoring the ShowBlogPostPage to extract the BlogPost detail in its component and other little stuff.

If it's ok with you, I can work on it!

@linkdotnet
Copy link
Owner Author

Hey @FrancescoRepo

also give the possibility to restore the original content in case the user wants to go back.

Interesting! Yeah that might be a good idea to restore the old state. Maybe we can also flag it as an experimental feature as I have no feeling on how well the transformation is that is produced by the library.

I also like your preview idea! I know that @ncosentino on his fork of the blog already did some refacotring. So there might be no need of reinventing the wheel here.

FrancescoRepo added a commit to FrancescoRepo/Blog that referenced this issue Nov 25, 2024
linkdotnet added a commit that referenced this issue Nov 27, 2024
* feat: #353 convert raw html to markdown and viceversa

* chore: refactor code with creator suggestions

* fix: Move package to correct category

---------

Co-authored-by: Steven Giesel <[email protected]>
@linkdotnet
Copy link
Owner Author

Closes by #381

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants