Skip to content

How to add an import while traversing in a remark plugin? #1971

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

You must be logged in to vote

We now have a proper AST for these things. You can look at the existing plugins that use it for inspiration: https://mdxjs.com/docs/extending-mdx/#list-of-plugins.

Note, from your existing attempts, the main thing is: we handle ASTs now, not strings. So the main difference is that you need to define an AST. Not a string.

Replies: 4 comments 9 replies

Comment options

You must be logged in to vote
0 replies
Comment options

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

You must be logged in to vote
9 replies
@wooorm
Comment options

@pgarciacamou
Comment options

@ChristianMurphy
Comment options

@wooorm
Comment options

@pgarciacamou
Comment options

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
6 participants