Skip to content

Migrate to MDX 2.0 #4029

Closed
Closed

Description

@slorber

🚀 Feature

We should migrate to MDX 2.0

PR: #8288


Update

  • The MDX 2 PR has been merged
  • I documented many breaking changes and provided some compatibility options (see PR)
  • A canary release is now available (>= 0.0.0-5556)
  • Need support to upgrade to MDX v2? See MDX v2 Upgrade Support

Please test it and give me some feedback here! 🙏

Activity

  1. added
    feature
    status: needs triage
    on Jan 12, 2021
  2. armano2 commented on Mar 22, 2021

    @armano2
    Contributor

    mdx 2.0 introduced breaking change, comments <!-- --> are not longer allowed in code, and thus mdxjs can't be used for simple markdown files

  3. slorber commented on Mar 22, 2021

    @slorber
    CollaboratorAuthor

    There are also disagreements in the MDX core contributors:

    There's also a "fork" xdm project from Titus himself.

    Let's not rush on this migration for now and see how things evolve.

  4. lunelson commented on May 17, 2021

    @lunelson

    I strongly encourage using xdm, it's a simpler, faster and more stable pipeline, it is always in sync with the remark/rehype ecosystem and its development is moving quickly

  5. birdofpreyru commented on Sep 15, 2021

    @birdofpreyru

    Ok, @lex111, probably then add a warning block to the top of https://docusaurus.io/docs/markdown-features/react page, saying that current Docusaurus uses MDX v1? Cause I believe the current docs do not mention it, and the linked MDX site pages do not make it clear that there are two version with some features not supported in v1.

  6. lex111 commented on Sep 16, 2021

    @lex111
    Contributor

    @birdofpreyru alright, although it seems self-evident for now, because MDX v2 is not officially released. However, the migration to MDX v2 will probably not be that easy, so it makes sense to do it (see #5575).
    FYI, earlier in header of MDX website listed its latest version, but currently they have removed that info.

  7. pomber commented on Oct 13, 2021

    @pomber

    MDX v2 release candidate landing soon

  8. slorber commented on Oct 19, 2021

    @slorber
    CollaboratorAuthor
  9. added this to the 2.0.0 milestone on Oct 29, 2021
  10. added
    proposal
    and removed
    feature
    status: needs triage
    on Oct 30, 2021
  11. added
    status: blocked
    on Nov 14, 2021
  12. parsnips commented on Nov 17, 2021

    @parsnips

    Would really love to get to v2 to have things like: mdx-js/mdx#821

    This would be a tremendous help for porting in plain markdown documents that have <pre /> or inline html fragments.

  13. 22 remaining items

  14. dprothero commented on Apr 5, 2023

    @dprothero

    😄 This is the processing layer I'm thinking of: str.replaceAll('<!--', '\\<!--')

    I know I'm late to the party, @slorber, but are we worried about code samples here? I could see that replacement potentially breaking an HTML snippet in a code fence.

  15. Josh-Cena commented on Apr 5, 2023

    @Josh-Cena
    Collaborator

    @dprothero We're probably not going to do that kind of naïve replacement. It would be contextual, so any code would be skipped.

  16. slorber commented on Apr 7, 2023

    @slorber
    CollaboratorAuthor

    😄 This is the processing layer I'm thinking of: str.replaceAll('<!--', '\\<!--')

    I know I'm late to the party, @slorber, but are we worried about code samples here? I could see that replacement potentially breaking an HTML snippet in a code fence.

    The way I see it is that I'll add a few env variables to turn compatibility options on. To make the upgrade simpler you'll be able to turn all the env variables on, and once you have fully migrated to MDX 2 you could remove the env variables.

    Will probably add an option to turn this on: https://github.com/leebyron/remark-comment (or maybe it will simply work if you pass it as a remark plugin, didn't try that yet)

    I also think I'll allow you to provide your own preprocessor so that you can handle the most complex cases yourself.

  17. linked a pull request that will close this issuefeat: upgrade to MDX v2 #8288on Apr 20, 2023
  18. slorber commented on Apr 21, 2023

    @slorber
    CollaboratorAuthor
    • The MDX 2 PR has been merged
    • I documented many breaking changes and provided some compatibility options (see PR)
    • A canary release is now available (>= 0.0.0-5556)

    Please test it and give me some feedback here! 🙏

  19. removed
    status: blocked
    on Apr 21, 2023
  20. chendrix commented on May 26, 2023

    @chendrix

    Am I to understand this isn't going to land in any of the 2.x releases and is being saved for 3.0.0?

  21. RudraSen2 commented on May 28, 2023

    @RudraSen2
    Contributor

    Am I to understand this isn't going to land in any of the 2.x releases and is being saved for 3.0.0?

    yes. this is for the 3.0 release

  22. ilg-ul commented on May 28, 2023

    @ilg-ul
    Contributor

    this is for the 3.0 release

    Any tentative release date for it?

  23. RudraSen2 commented on May 28, 2023

    @RudraSen2
    Contributor

    this is for the 3.0 release

    Any tentative release date for it?

    I don't know, You can ask the docusaurus team.

  24. slorber commented on May 30, 2023

    @slorber
    CollaboratorAuthor

    This is a breaking change, and it is very likely that upgrading to Docusaurus v3 + MDX v2 will require you to edit some docs to fix some little issues due to those changes.

    So no it won't be in v2.x

    I hope to release the v3 first alphas soon.

    In the meantime, you already are able to use the canary releases. Canaries are safe to use in production if you pin the canary version. In the end, the v3 release will just be a future canary release tagged as v3.

  25. slorber commented on Jun 9, 2023

    @slorber
    CollaboratorAuthor

    Struggling to upgrade your site to MDX v2?

    Here's a discussion to ask for support: #9053

  26. 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

    domain: dependenciesdomain: markdownproposal

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions