-
I'm trying to pass some properties to the code, to treat it visually when rendered. I'm using a lib When I try to get
Element tree:
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
If you have elements, you are not making a remark plugin, but a rehype plugin. If you want to parse the meta string on fenced code as if it were JSX attributes, then there is already a plugin for that: https://github.com/remcohaszing/remark-mdx-code-meta. You seem to be making your own plugin to do syntax highlighting. |
Beta Was this translation helpful? Give feedback.
If you have elements, you are not making a remark plugin, but a rehype plugin.
If there are
h*
fields on elements in rehype, something is going horribly wrong. Those fields should be available on mdast (markdown, remark) nodes, they should be gone on hast (HTML, rehype) nodes.If you want to parse the meta string on fenced code as if it were JSX attributes, then there is already a plugin for that: https://github.com/remcohaszing/remark-mdx-code-meta.
You seem to be making your own plugin to do syntax highlighting.
A good reference for that is: https://github.com/wooorm/starry-night#example-integrate-with-unified-remark-and-rehype.
In hast, when coming from markdown,
<code>
element haveno…