Skip to content

Conversation

@axe312ger
Copy link
Contributor

@axe312ger axe312ger commented May 13, 2022

This PR replaces the old gatsby-plugin-mdx with a new version that is powered by MDX v2.

We won't be 100% backwards compatible, but most use cases will be covered. Simplification and better performance is the overall goal.

Separate PRs

Changes:

This is a complete rewrite of the plugin, so some old features might be gone.

New features

  • Upgraded all dependencies including MDX to v2
  • Per file tree-shaking and chunking via webpack
  • MDXRenderer is no more needed.
  • Similar or better performance than old plugin. (First tests on complex projects show similar performance)
  • Extended e2e tests
  • Simplified plugin configuration
  • Via the mdxOptions config option you can pass any configuration to @mdx-js/js compile like remarkPlugins, rehypePlugins, recmaPlugins and more.
  • Move away from react-test-renderer in tests
  • Authored in TS

Kept features

Removed features

  • (compiled) MDX code won't be available anymore within GraphQL
  • MD nodes are no more automatically turned into MDX
  • config option defaultLayouts is gone
  • config option lessBabel is gone
  • config option mediaTypes is gone
  • config option shouldBlockNodeFromTransformation is gone
  • some GraphQL data is no more available in core and have to be implemented on project level (like time to read)

Post Release ToDos

Closes #25068
Closes #34421
Closes #35733
Closes #35732

@gatsbot gatsbot bot added the status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer label May 13, 2022
@axe312ger axe312ger force-pushed the feat/mdx-v2 branch 2 times, most recently from e0b26c8 to cb0bf76 Compare May 13, 2022 13:50
@Khaledgarbaya Khaledgarbaya added the topic: remark/mdx Related to Markdown, remark & MDX ecosystem label May 16, 2022
@LekoArts LekoArts added breaking change If implemented, this proposed work would break functionality for older versions of Gatsby and removed status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer labels May 17, 2022
@LekoArts LekoArts added this to the MDX v2 milestone May 17, 2022
@LekoArts LekoArts changed the title Feat: MDX v2 BREAKING CHANGE(gatsby-plugin-mdx): MDX v2 May 30, 2022
@axe312ger axe312ger mentioned this pull request Jun 8, 2022
5 tasks
@alvinometric
Copy link

I'm so excited about this! Great work @axe312ger 👏 👏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking change If implemented, this proposed work would break functionality for older versions of Gatsby topic: remark/mdx Related to Markdown, remark & MDX ecosystem

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MDX v2 - Adding Tests Create a new gatsby-plugin-mdx

9 participants