Register a provided component in a theme #11540
Replies: 1 comment
-
|
These are known limitations that we'd like to solve, see past discussions:
This is also a problem we have ourselves with the Mermaid plugin. We found a way to "automatically" register it by using a remark plugin that maps the diagram code block syntax to an actual component:
But it's not ideal because we still don't have any way to register that remark plugin automatically when the mermaid theme is added, and we had to put some mermaid-specific logic in Docusaurus core (mdx-loader package), unfortunately. In the future, I would like to make it as easy as: export default {
themes: ['@docusaurus/theme-mermaid'],
- markdown: {
- mermaid: true,
- },
};I'm not sure you encountered exactly the same problem as us, though. You didn't share the syntax your users are expected to use to display your diagrams, so I can only assume it's doing something similar to our mermaid plugin: using md code blocks with a mermaid language. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm building a theme for docusaurus that provides a React diagram component which should be used in MDX. Is it possible to register those components via theme plugin configuration? I've worked around it by asking users to add the component explictly via https://docusaurus.io/docs/next/markdown-features/react#mdx-component-scope but maybe I'm missing an obvious way?
Beta Was this translation helpful? Give feedback.
All reactions