Skip to content

Import multiple MDX files don't play well with rehype-slug #2293

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

You must be logged in to vote

This behavior you describe is not particularly a bug. Or a feature. It’s more: that’s the way things work, there is no alternative.

Plugins work on ASTs. They infer things statically. Perhaps on a server.
Importing things is a JavaScript runtime thing. They could result in anything. Dynamically. Perhaps on a client.

Take for example a heading with an expression: # {name}. Where the name variable could at runtime come from a database, local storage, whatever. It is impossible for plugins (server) to “see” what you are going to show there.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by xuanngo2001
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