-
-
Notifications
You must be signed in to change notification settings - Fork 489
Description
🖐️ Hello, I'm currently working on vue-markdown, which uses Unified to convert Markdown into HAST before rendering it as Vue components.
While trying to support @shikijs/rehype, I noticed that the HAST it produces includes a Root node as the outermost element, followed by the highlighted content. According to the HAST specification, the Root node should “never be a child” (source). Because of this, I initially didn’t handle the Root node, which resulted in Shiki-highlighted content not being rendered correctly.
Shiki adds a Root node as a base when converting to HAST (code reference).
Here’s a reproduction of the issue:
https://stackblitz.com/edit/stackblitz-starters-eddwspb8?file=index.js
Since this Root node becomes a child during the Markdown rendering process, it violates the HAST specification. I’m wondering: is this output appropriate? Would you consider removing the Root node from the output?