Skip to content

Translating a new mdast tag to hast #1467

Answered by wooorm
glitteringkatie asked this question in Q&A
Discussion options

You must be logged in to vote

Heya!

I think you’re looking for: a way to define on markdown nodes, what they should turn into when they are turned into hast.

Here is an example for some emoji, that should be wrapped in an element with a class: https://codesandbox.io/s/remark-rehype-debug-forked-zs711?file=/src/index.js:858-1180. Note the data, the rest isn’t important. Here are some docs and examples on how hName and hProperties should look: https://github.com/syntax-tree/mdast-util-to-hast#examples.

But I am unsure what you mean by “My remark plugin successfully tags something like the example above as inlineVariable but by the time I get over to the rehype plugin, the inlineVariable tag is gone.”. a) I thought you r…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by glitteringkatie
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants