Skip to content
Discussion options

You must be logged in to vote

If the components are in the MDX map, they are automatically available everywhere: MDX docs use them from the React context.

Otherwise, they need to be imported, either manually or automatically.

Here's an example Remark plugin that automatically adds imports to all MDX docs containing npm2yarn code blocks: https://github.com/facebook/docusaurus/blob/main/packages/docusaurus-remark-plugin-npm2yarn/src/index.ts

Note: in the future we'd like to introduce an API so that plugins can register remark plugins automatically. For now, you'd have to document in your lib that users need to add the remark plugin manually if they want those components to become ambiantly available

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@b-kamphorst
Comment options

@slorber
Comment options

slorber Mar 24, 2026
Collaborator

Answer selected by b-kamphorst
@b-kamphorst
Comment options

@slorber
Comment options

slorber Mar 25, 2026
Collaborator

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