MDsveX icon indicating copy to clipboard operation
MDsveX copied to clipboard

Parsing HTML tags inside Markdown

Open rChaoz opened this issue 10 months ago • 2 comments

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:

  • "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.

rChaoz avatar Apr 24 '24 12:04 rChaoz