-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use mdx instead of markdown-to-jsx. #970
Comments
This comment has been minimized.
This comment has been minimized.
Could you elaborate on that? You can
It would be a breaking change — users will have to rewrite all their examples, it would make viewing Markdown files as Markdown (for example on GitHub) impossible, because examples are just text. We need to have a very good reason for this change and so far I don't see any.
From your examples I only see one feature: execute any code without rendering it, which wouldn't be hard to support with a new modifier. |
As an example wtih markdown-to-jsx I need to do the following; <Markdown
children={md}
options={{
overrides: {
ColorPalette: {
component: ColorPalette,
},
},
}} /> And then I can use the following within my markdown files; # Colors
<ColorPalette /> It works but it will be directly available within every markdown template. import ColorPalette from './components/ColorPalette';
# Colors
<ColorPalette /> So the import will only available within the markdown template where you do need it.
The same thing is viable with mdx, the only main difference I see at this moment is that the Markdown will be converted on compile time instead of run-time.
It would If users did overwrite the Markdown component in styleguidist.
So I thought it could be viable to make the proposed changes. |
You can do the same now: const ColorPalette = require('./components/ColorPalette').default;
<ColorPalette /> We only use markdown-to-jsx to render Markdown, examples are rendered separately and we have to transpile the code before running it in the browsers (we use Buble for that). |
@sapegin I didn't know that, for me this was the only / main reason to request this change. Thank you for the quick response. This would look as following in the markdown if I understand you correctly. ```js no-editor
const ColorPalette = require('./components/ColorPalette').default;
<ColorPalette /> Mdx is also only used to render the Markdown it would not have anything to do with the code examples. |
Before I would submit a PR to
react-styleguidist
I want to know what your opinion would be about using mdx instead of markdown-to-jsx.It would basically works the same as
markdown-to-jsx
, only that it comes with some more handy features to customize the templates.The problem
It is now not possible to import custom components within styleguidist without overwriting the internal Markdown component from rsg-components.
With mdx the following would become possible;
Proposed solution
Adding the webpack mdx loader to the core webpack config.
The text was updated successfully, but these errors were encountered: