Skip to content
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

Improve markdown infrastructure: global markdown config, new lifecycles... #4625

Closed
slorber opened this issue Apr 16, 2021 · 6 comments
Closed
Labels
feature This is not a bug or issue with Docusausus, per se. It is a feature request for the future.
Milestone

Comments

@slorber
Copy link
Collaborator

slorber commented Apr 16, 2021

🚀 Feature

Problems to solve:

  • The markdown config (remark/rehype plugins) is often duplicated between multiple plugins
  • There's no central place to configure markdown/MDX for the whole site at once
  • It's not possible to build markdown-enhancement Docusaurus plugins
  • It's not possible to disable the default emoji plugin (How to disable :emoji: replace? #5450)

We should allow users to configure default markdown config globally, change Docusaurus Markdown defaults, and make it possible to create markdown-related Docusaurus plugins.

A good example would be to create a "docusaurus-plugin-latex" so that scientists can more easily adopt Docusaurus without having to go through more complicated steps (see https://docs.theochu.com/docusaurus/latex/)

Related to #3018

@slorber slorber added the feature This is not a bug or issue with Docusausus, per se. It is a feature request for the future. label Apr 16, 2021
@nilsocket
Copy link

nilsocket commented Apr 16, 2021

Edit by @slorber: context is (#3018 (comment))


I write notes of whatever I study in markdown files organized into folders.

I use vscode-markdown-preview-enhanced, which works perfectly for all my use-cases.

I need my content to be accessible, on other devices like mobile, for revision purposes.

I was thinking to host a local server which serves .md files.

As I'm not familiar with front-end development, it's confusing to configure and I don't understand much.

But the link which you have provided is fine for me. I will configure it.
Thanks a lot.

@slorber
Copy link
Collaborator Author

slorber commented Oct 8, 2021

The markdown global infrastructure should allow site owners and themes to register mdx components and scope.

This would remove the need to use mdx imports, and also ensure the blog post RSS feed can evaluate MDX nodes properly. See also #5664

@Josh-Cena
Copy link
Collaborator

Question: won't this conflict with #3018? Are we going to allow swapping out Markdown parsers, or are we going to build our infrastructure on MDX?

@slorber
Copy link
Collaborator Author

slorber commented Oct 8, 2021

When using CommonMark, we'll likely inject the markdown in components prop as JSON AST, rendered on the client with https://github.com/remarkjs/react-markdown

It should be technically possible to replace things like <Tabs> by the respective theme component, so that interactive elements are still possible without MDX. The difference is that you'd likely have to declare the available components ahead of time in config/lifecycles instead of importing them inline in the MDX file (which IMHO is not the most convenient even with MDX)

@slorber
Copy link
Collaborator Author

slorber commented Oct 8, 2021

My definitive goal is that the Docusaurus site could render the same in both CommonMark + MDX, with a simple config switch and CI tests for each mode.

This might need some docs adjustments but I believe it should be possible without removing any existing feature.

@Josh-Cena
Copy link
Collaborator

Going to close this in favor of #5568, #3018 and #6370. Those are smaller and more concrete proposals that seem more actionable.

@slorber slorber modified the milestones: 3.x+, 3.0 Aug 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature This is not a bug or issue with Docusausus, per se. It is a feature request for the future.
Projects
None yet
Development

No branches or pull requests

3 participants