-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Add new transformer for MDX v2 #8625
base: v2
Are you sure you want to change the base?
Conversation
That is caused by v8-compile-cache I believe... |
module.exports = new Transformer({ | ||
async loadConfig({config}) { | ||
// config.getConfig only works with CJS | ||
let configFile = await config.getConfig(['.mdxrc.js', '.mdxrc.cjs'], { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To follow https://github.com/mdx-js/mdx/blob/v1/packages/parcel-plugin-mdx/src/MDXAsset.js#L13, I could add mdx.config.js
and mdx.config.cjs
.
Or just use those 2 instead of .mdxrc.js
(as usually the rc files are JSON files, not JS files)
↪️ Pull Request
Other variant for #7922 to solve #7934.
The main differences are:
@parcel/transformer-mdx-2
instead of modifying the existing.For the MDX config, you can add a
.mdxrc.js
or.mdxrc.cjs
file at the root of your repo to be able to customise MDX's behavior (see https://mdxjs.com/packages/mdx/#optionsremarkplugins).Note: I tried to build parcel locally but
yarn build-native
gets stuck. So i couldn't test this PR locallyNote 2: to make it work, we also need
@parcel/transformer-js
as MDX v2 generates ESM code:💻 Examples
Previous MDX examples should still be applicable.
I also added a example here with some MDX config too: https://github.com/Ayc0/test-parcel/blob/7d05ca9/src/hello.mdx
🚨 Test instructions
Previous MDX tests should still be applicable.
But I also added a new one (not really sure if this is used).
I also created a repo here: https://github.com/Ayc0/test-parcel/blob/7d05ca9/src/hello.mdx
Notice the MDX 2 specific syntaxes like
{a}
or the MD in HTML, and that the strikethrough and the table work (provided by GFM):✔️ PR Todo