pngwn / MDsveX

A markdown preprocessor for Svelte.
https://mdsvex.pngwn.io
MIT License
2.27k stars 96 forks source link

Parsing HTML tags inside Markdown #598

Open rChaoz opened 2 months ago

rChaoz commented 2 months ago

Problem

Consider the following Markdown:

This is some Markdown with a <kbd>Kbd</kbd> tag

This results in a tree similar to this: image

I would expect the tree to be:

Instead, it is:

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.