MDX v2: ☂️ Umbrella issue
See original GitHub issue👋 Hey folks, the time has come to begin putting together MDX v2. We’ve been aggregating feedback, working on parsing, and we think we now have all of our 🦆🦆🦆🦆 ducks in a line to begin releasing a next
tag in the next week.
Please note: Nothing written here is final and we’d love for contributors, users, and anyone else to comment with ideas, opinions, and questions/concerns.
Features
- 🤖Drastically improved parsing led by @wooorm in #1039. This will handle a wide array of parsing issues that have been brought up over the last year with a robust solution. The new parser will address a large amount of papercuts users have been working around for far too long. It also adds JSX usage into the AST which will allow users to perform their own transforms with plugins. One of the more notable additions here is the ability to support expressions throughout a document (also a breaking change).
- 🚀Official Vue support led by @codebender828 and @ChristopherBiscardi in #1029. The previous alpha implementation of Vue was buggy and not updated with MDX as it evolved. We no longer have a custom transpiler for Vue and only have to implement a custom renderer/pragma. This is so huge and we’re delighted @codebender828 took on this monumental effort.
- 🧩TypeScript support led by @ChristianMurphy. The public facing packages feature official types with tests.
Breaking changes?
Generally speaking, most of the breaking changes will be internal and shouldn’t directly affect end users. We haven’t yet shipped them, though, because they are technically changing behavior users may’ve been depending on (which will be documented below).
However, with the parsing overhaul (#1039) the syntax has been formalized which will likely cause issues for characters that aren’t HTML encoded, <
and {
, (some of which we’ll be able to address with codemods).
- Parsing changes outlined in #1039
components
for the pragma prop has been renamed tomdxComponents
https://github.com/mdx-js/mdx/issues/638- Removal of
layoutProps
being passed toMDXContent
/wrapper
https://github.com/mdx-js/mdx/issues/742 - Remove deprecated
mdPlugins
andhastPlugins
options https://github.com/mdx-js/mdx/issues/718
RFCs
The following RFCs (request for comments) are either accepted (✅), being discussed (💬), declined (✖️), or need to be written (📝). If you have opinions here, please chime in on these issues as they will affect the v2 release.
- ✅ Officially drop node 8 support https://github.com/mdx-js/mdx/issues/978
- ✖️Consolidate pre/code/inlineCode https://github.com/mdx-js/mdx/issues/743
- ✅ MDX plugins (this will likely land as 2.2) https://github.com/mdx-js/mdx/issues/741
- ✅ Interleaving Markdown in JSX (PR #1039) https://github.com/mdx-js/mdx/issues/628
- 💬 MDX comment syntax https://github.com/mdx-js/mdx/issues/1042
- ✅ MDXs (this will likely land as 2.3, and as a plugin) https://github.com/mdx-js/mdx/issues/454
- ✅ let/const/var support (this will likely land as 2.1) https://github.com/mdx-js/mdx/issues/1046
- ✅ Remove autolink syntax https://github.com/mdx-js/mdx/issues/1049
- 💬 MDX block parsing https://github.com/mdx-js/mdx/issues/1170
Work left to complete or currently in flight
If you have any interest in working on any of these tasks please let us know! We’d be happy to help guide anyone along.
- Update
eslint-mdx
https://github.com/mdx-js/eslint-mdx/issues/204 - Sync with upstream/downstream dependencies https://github.com/mdx-js/mdx/issues/1045
- Implement the new homepage and website graciously designed by egghead https://github.com/mdx-js/mdx/issues/444
- Vue documentation https://github.com/mdx-js/mdx/issues/851
- Implement v1 and v2 benchmarks https://github.com/mdx-js/mdx/issues/1044
- Implement v1 to v2 codemods for MDX files https://github.com/mdx-js/mdx/issues/1043
- Update the necessary TypeScript types #1078
- Use babel standalone instead of core https://github.com/mdx-js/mdx/issues/704
- Add ability to opt out of literal HTML elements using MDXProvider https://github.com/mdx-js/mdx/issues/821
- Improve import/export parsing
- Improve export name extraction https://github.com/mdx-js/mdx/pull/1160
-
export { default } from './foo'
https://github.com/mdx-js/mdx/issues/961 -
import * as Foo from './foo'
https://github.com/mdx-js/mdx/issues/1050
- Missing MDXProvider docs https://github.com/mdx-js/mdx/issues/919
- Only call makeShortcodes when there are shortcodes being used https://github.com/mdx-js/mdx/issues/721
- Document an MDX spec and an MDXJS spec that aren’t tied to unified
- MDX showcase https://github.com/mdx-js/mdx/issues/414
- Handle JSX member expressions https://github.com/mdx-js/mdx/pull/953
- Start publishing canaries under the
next
tag - Take v2 canaries on a spin with open source sites, ask for the community to test on their sites
- Consolidate
remark-mdx
andremark-mdxjs
, imports and exports can be turned off with an option - Create an
mdx
package that includes all packages with exports like:mdx/react
andmdx/vue
Encountered bugs
- Curlies in JS strings https://github.com/mdx-js/mdx/issues/1081
- Serializing inline links https://github.com/mdx-js/mdx/issues/1169
Performance considerations
- Dropping down to one babel step, perhaps returning JS rather than JSX by default https://github.com/mdx-js/mdx/issues/1152
How can you help?
Let us know if you want to take on any of the issues that don’t yet have folks assigned. You can also take the canary for a spin and let us know if you encounter any problems:
yarn add @mdx-js/mdx@next @mdx-js/react@next
Is there something missing? Is there something you’re concerned about?
Issue Analytics
- State:
- Created 3 years ago
- Reactions:114
- Comments:21 (8 by maintainers)
Top GitHub Comments
Hey all!
V2 was finally released, thanks for everyone who contributed, and for everyone who waited! ✨ More on v2 in the release and on the site: https://github.com/mdx-js/mdx/releases/tag/2.0.0.
Hey @shilman, we’re hoping for an RC in the by June, and if all goes well a mid July release. Generally speaking, the breaking changes should be pretty light because they’re generally internals aside from the new parsing changes (which we will also offer a codemod that should address most problems that might arise).
Hopefully this corresponds nicely with you folks? I’m pretty busy this week with other things, but plan on picking MDX v2 back up full time starting next week.