Different remark AST compared to built in plugins #9679
-
I use the source code of Docusaurus as an example, when trying to create my own remark plugin and although it seems that my plugin is used the same way in processor.ts, it can not visit some nodes the same way the default plugins can. For example where the head plugin visits For some reason the first argument in the returned function from my plugin gets a different tree, compared to the default plugins. This is the same for both Thank you in advance! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
@anatolykopyl, are you using Docusaurus v3? Seems you are handling MDX v1 AST. |
Beta Was this translation helpful? Give feedback.
-
Not quite what you're after, but this blog post (and the related ones) will give you a sense of the different AST that old and new MDX have. I say it's not quite what you're after as these are rehype plugins, but I thought I'd share on the off chance https://johnnyreilly.com/docusaurus-3-how-to-migrate-rehype-plugins |
Beta Was this translation helpful? Give feedback.
No; MDX v1 uses a different tree. Read examples here instead: https://github.com/facebook/docusaurus/tree/docusaurus-v2/packages/docusaurus-mdx-loader/src Curiously, https://astexplorer.net/ still uses the MDX v1 parser, so you can test there.