-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
MDX 3 #12209
Comments
Remark and MDX ecosystems use Pure ECMAScript Modules Packages. We need to use that parser, and I think the our ECMAScript Modules migration(#10157) block this work. |
For now, As a first step, I will restart the migration to remark-parser v9 (#11938) |
As you’re already bundling prettier when releasing, could you bundle mdx-js/mdx / remark-parse and such as CJS? |
Do you mean bundling ESM Packages( /cc @fisker |
I’m suggesting something like an npm script that works like this: npx esbuild @mdx-js/mdx --bundle --platform=node --outfile=vendor/mdx.js That could be run once in a while. Like, every month? It doesn’t have to affect running Prettier in development? |
Thank you! I think we can use the way you suggested. It may solve the problem that we cannot use other Pure ESM packages I'll try it. |
Just to add, when the parsing does work, the inline markdown within components in MDX2 is mangled - see the Playground example here Input <div>
## foo
a paragraph
another paragraph
</div> Output <div>## foo a paragraph another paragraph</div> Expected output <div>
## foo
a paragraph
another paragraph
</div> Not sure whether the parser update will fix this. |
Thank you people for working on this.
Prettier automatically changes it to:
Which breaks MDX parsers -- this is no longer a valid Javascript/JSX expression and it won't be executed. Using Prettier's recommended Thank you. |
we unpin this issue temporary because we should pin #12931 |
We have to note that new MDX parsers will not treat **この部分は強調とみなされなくなりました。**ご注意ください。 |
@tats-u I think your time is better spent working on a solution rather than spamming all projects that do something with markdown. If you don’t know how to solve it, you could try and motivate other Chinese or Japanese speakers involved. |
@wooorm I would not like to post an extra comment, but sou should not have used the verb "spam" before evaluating my suggestion on that issue even though I should have posted it on issues or PRs that directly mention on upgrading remark-parse instead. You must have noted that this change will have to be added in the change log in the version that updates the remark parser and MDX before posting the comment. |
(looks like I mistakenly somehow posted the same comment twice) |
I forgot to say that some test cases related to CJK languages might have to be modified when upgrading remark to newer versions to support MDX v3 (PRs trying to do are stagnant). |
I won't fix such cases at least, they would be known issues if I'm developing, it is out scope of prettier itself. |
…fixed (prettier#15221) State that the supported version of MDX is 1
MDX #15221 |
…ge (#177) This PR fixes #174 with a new `VersionedDocsLink` component that reads the docusaurus config to determine what the latest stable version is. It also adjusts the other dynamic link to the contribution guide to use this. This link is changed from the latest RC versions (currently 2.20) to the current `main` version (2.21), i.e. the absolute most up-to-date version of the contribution guide, which seems most relevant to contributors since they'll be starting in the `main` branch. This has a few issues with the component due to prettier/prettier#12209, which forces us into a very long line on the `_index.mdx` page. I'm unclear if a broken link will be detected or not.
# Pull Request ## 🤨 Rationale I needed an example of component usage guidance for an NITech presentation ## 👩💻 Implementation Capture my understanding of when to use select, combobox, and radio in each of their MDX files. I moved the combobox description from storybook to mdx because it was annoying to format large markdown strings from code. Updated language for existing usage guidance to match new pattern. - my secret motivation is working around a prettier bug that puts tags near the end of a line in a new paragraph, leading to ugly docs. I couldn't find a syntax to `prettier-ignore` in mdx files. [nor can](prettier/prettier#12209) [other people](https://stackoverflow.com/questions/69311134/prettier-how-to-ignore-a-single-line) <img width="471" alt="image" src="https://github.com/user-attachments/assets/dcfc9364-25f2-4cf1-96ee-e54b56752ad5"> ## 🧪 Testing Local storybook ## ✅ Checklist <!--- Review the list and put an x in the boxes that apply or ~~strike through~~ around items that don't (along with an explanation). --> - [x] I have updated the project documentation to reflect my changes or determined no changes are needed.
So how would one go about this? Update the mdx dependency and fix all the tests? Is it that simple? Is there a WIP branch on this? |
I think this may be the first PR to watch here, because upgrading |
I am toying with the idea to do some coding too. So I would make my own PR or continue someone others work in my own PR. The PR you referenced looks pretty heavy handed to me. Pretty hard to understand what is going on. And all the changes to the snapshots make me wary. Will people really accept these? |
MDX 2 was released on 1 Feb 2022: https://github.com/mdx-js/mdx/releases/tag/2.0.0
UPD: MDX 3 was released on 24 Oct 2023: https://github.com/mdx-js/mdx/releases/tag/3.0.0
The changes are summarised in the blog post: https://mdxjs.com/blog/v2/
UPD: https://mdxjs.com/migrating/v3/
Here is a big one for Prettier:
The example below is from the blog post. It is a valid MDX in v2, but Prettier 2.5.1 is unable to parse it:
Prettier 2.5.1
Playground link
Input:
Output:
Expected behavior:
No syntax error
Let’s track MDX
23 support here 👀The text was updated successfully, but these errors were encountered: