[addon-docs] Add support for providing remark plugins in docs
See original GitHub issueIs your feature request related to a problem? Please describe. See the twitter discussion I had with @shilman.
Currently if the user wants to add new remark plugins to docs, they have to manually create the loader in conjunction with createCompiler
, as seen in the doc.
const createCompiler = require('@storybook/addon-docs/mdx-compiler-plugin');
const emoji = require("remark-emoji");
{
loader: "@mdx-js/loader",
options: {
compilers: [createCompiler({})],
remarkPlugins: [emoji] // <--
}
}
Describe the solution you’d like
We can add a new option in addon-docs
to add the remarkPlugins
(and other loader options) to the mdx loader, called mdxLoaderOptions
.
const emoji = require("remark-emoji");
module.exports = {
addons: [
{
name: "@storybook/addon-docs",
options: {
mdxLoaderOptions: {
remarkPlugins: [emoji] // <--
}
}
}
]
};
Currently we already have 2 default remark plugins. We can just simply override the options and expect the users to add them back if they still want those plugins.
Describe alternatives you’ve considered We could dedup the provided plugins, but that might be a bad idea.
Are you able to assist bring the feature to reality? Sure! 😃 Any heads-up for where to look into?
Issue Analytics
- State:
- Created 4 years ago
- Reactions:3
- Comments:10 (9 by maintainers)
Top GitHub Comments
And FWIW there is a simple workaround for now https://twitter.com/frassinier/status/1381581824699273222
I think adding an
mdxLoaderOptions
to the docs preset would be 💯! cc @patricklafrance