MDsveX
MDsveX copied to clipboard
Parsing HTML tags inside Markdown
Problem
Consider the following Markdown:
This is some Markdown with a <kbd>Kbd</kbd> tag
This results in a tree similar to this:
I would expect the tree to be:
- "This is some Markdown with a "
-
<kbd>
element- "Kbd"
- " tag"
Instead, it is:
- "This is some Markdown with a "
-
<kbd>
(raw) - "Kbd"
-
</kbd>
(raw) - " tag"
This causes issues as, for example, I'm using rehype-class-names to apply the correct classes to tags for styling, and it doesn't apply classes to the kbd
element in this example.
Questions
I would believe this is intended - deal with markdown, leave everything else as-is (with the "raw") type. However, is there a way to achieve what I'm trying to do?
Also, I'm talking pure .md
files, not Svelte-Markdown mix (.svx
), so there is only pure HTML to parse in my case.