-
-
Notifications
You must be signed in to change notification settings - Fork 8.6k
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
Move remarkPlugins to markdown config #5999
Comments
Do we really want to remove the existing plugin options? Maybe we can keep both? Also worth taking into consideration: in the future, a plugin should be able to add global md plugins to your site. For example we should be able to create a |
Sure, it's just me getting tired of keeping two APIs that do the same. We can keep the legacy one work for some time (ideally removing it before the RC release), but they can't interop because there isn't a nice way to merge them.
Umm, maybe we should have a preset instead, since we are already introducing the concept of remark/rehype presets? I also thought about the "real global Markdown config", i.e. lifecycles, which is the crux of #4625. But after some pondering, I think plugins are one level higher than the MDX infrastructure. It just happens that all the three content plugins all use MDX for content loading—they could well use reStructuredText, LaTeX, or other markup/typesetting languages. We need to have a decent abstraction to not break the modularity of plugins. With a more unified Markdown infrastructure, however, we will be able to do the file path => URL mapping between plugins (cf #3020 (comment)). Maybe we can use the same idea (i.e. make plugins register global data that's usable on server-side)? |
Have you read the Contributing Guidelines on issues?
Description
Current plugin-level remark/rehype configuration should be replaced with a global configuration.
Has this been requested on Canny?
No
Motivation
After #5972 we will have a
siteConfig.markdown
field. It's time to populate it with more options.API design
It will accept a function or an array (inspired by Babel's caller):
Moreover, this API would allow us to override default plugins (#5450), inspired by SVGO's approach of using presets. I.e. you would need to explicitly need to tell Docusaurus where to insert the default plugins:
To disable a particular plugin or pass in options, do it as you expect:
I don't think it's necessary for us to insert extra plugins somewhere between default plugins, so treating them as a chunk is fine.
I also propose that we have more built-in plugins to be enabled, e.g. we can move
npm2yarn
to the preset. I also want to build another plugin that transformsstyle="color:red"
tostyle={{color:'red'}}
andclass="foo"
toclassName="foo"
(i.e. make casual users happy)Have you tried building it?
No
Self-service
The text was updated successfully, but these errors were encountered: