Skip to content

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

Closed

Description

@slorber

🚀 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

Activity

  1. added
    feature
    on Apr 16, 2021
  2. nilsocket commented on Apr 16, 2021

    @nilsocket

    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.

  3. slorber commented on Oct 8, 2021

    @slorber
    CollaboratorAuthor

    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

  4. Josh-Cena commented on Oct 8, 2021

    @Josh-Cena
    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?

  5. slorber commented on Oct 8, 2021

    @slorber
    CollaboratorAuthor

    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)

  6. slorber commented on Oct 8, 2021

    @slorber
    CollaboratorAuthor

    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.

  7. added this to the 2.0.0 GA milestone on Oct 29, 2021
  8. modified the milestones: 2.0.0, 3.0.0 on Dec 16, 2021
  9. Josh-Cena commented on Mar 25, 2022

    @Josh-Cena
    Collaborator

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

  10. modified the milestones: 3.x+, 3.0 on Aug 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions