-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Tilde (~) character inside JSX component breaks in MDX v2 #1238
Comments
Current workaround would be to do something like:
|
Nice catch! The reason for that is that code should be skipped:
Or:
While correctly parsing code is a bit more involved, I chose to require that |
@wooorm Is correctly parsing code something that you want to keep this open for on the radar? These workarounds are all pretty acceptable but since this parses fine in v1 https://mdxjs.com/playground/ should it be logged as a breaking change somewhere. |
I'd say both describe it in a migration guide, and keep it open while we're gathering more feedback from folks! |
This updates MDX to use and support remark@13, which comes with a new internal parser (micromark), and supports CommonMark. See <https://github.com/remarkjs/remark/releases/tag/13.0.0> for more information. In short, this means MDX parses markdown closer to what folks expect. And it means all latest plugins work (again). But it also means that parsing MDX syntax (JSX, expressions, ESM) got an update. See: <https://github.com/micromark/micromark-extension-mdxjs> and <https://github.com/syntax-tree/mdast-util-mdx> for the syntax. In short, this means MDX parsing is now JavaScript-aware: import/exports are actually parsed for being valid JavaScript. Expressions previously counted braces, but now can include braces in strings or comments or whatnot. This also means we can drop Babel (in a future PR) because we already have a JavaScript AST. This also deprecates the packages `remark-mdxjs` (which is now the default in `remark-mdx`), `remark-mdx-remove-exports`, and `remark-mdx-remove-imports`. Related to GH-704. Related to GH-1041. Closes GH-720. Closes GH-1028. Closes GH-1050. Closes GH-1081. Closes GH-1193. Closes GH-1238. Closes GH-1283. Closes GH-1316. Closes GH-1318. Closes GH-1341.
This updates MDX to use and support remark@13, which comes with a new internal parser (micromark), and supports CommonMark. See <https://github.com/remarkjs/remark/releases/tag/13.0.0> for more information. In short, this means MDX parses markdown closer to what folks expect. And it means all latest plugins work (again). But it also means that parsing MDX syntax (JSX, expressions, ESM) got an update. See: <https://github.com/micromark/micromark-extension-mdxjs> and <https://github.com/syntax-tree/mdast-util-mdx> for the syntax. In short, this means MDX parsing is now JavaScript-aware: import/exports are actually parsed for being valid JavaScript. Expressions previously counted braces, but now can include braces in strings or comments or whatnot. This also means we can drop Babel (in a future PR) because we already have a JavaScript AST. This also deprecates the packages `remark-mdxjs` (which is now the default in `remark-mdx`), `remark-mdx-remove-exports`, and `remark-mdx-remove-imports`. Related to GH-704. Related to GH-1041. Closes GH-720. Closes GH-1028. Closes GH-1050. Closes GH-1081. Closes GH-1193. Closes GH-1238. Closes GH-1283. Closes GH-1316. Closes GH-1318. Closes GH-1341. Closes GH-1367. Reviewed-by: Christian Murphy <[email protected]>
Hi all! I’m going to close this as it landed on the The reason is so that it’s more clear which issues still need to be solved already and don’t require further work. Expect another For more info, see #1041. |
Subject of the issue
Tildes (
~
) inside MDX blocks in v2 do not parse.Your environment
N/A can be reproduced in the v2 playground https://mdx-git-next.mdx.vercel.app/playground.
Steps to reproduce
~1 foot.
parses as expected.Expected behavior
Should parse successfully.
Actual behavior
The text was updated successfully, but these errors were encountered: