Repository navigation
refactor(mdx-loader): allow passing remark-mdx options (AI-assisted) - #12484
Merged
Merged
Conversation
✅ [V2]
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
Size Change: 0 B Total Size: 12.4 MB ℹ️ View Unchanged
|
⚡️ Lighthouse report for the deploy preview of this PR
|
|
The latest updates on your projects. Learn more about Argos notifications ↗︎
|
|
Size Change: 0 B Total Size: 12.5 MB ℹ️ View Unchanged
|
2 of 3 tasks
slorber
force-pushed
the
slorber/mdx-loader-remark-mdx-options
branch
from
September 24, 2026 15:07
4c253a7 to
e798cf9
Compare
This was referenced Sep 24, 2026
MDX's createProcessor() registers remark-mdx without options. Re-register remark-mdx through remarkPlugins so unified reconfigures the existing attacher in place, at its original pipeline position. No behavior change: default options are equivalent to no options. See mdx-js/mdx#2628 Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ut remark-mdx options (AI-assisted) Co-Authored-By: Claude Opus 5.5 <[email protected]>
slorber
force-pushed
the
slorber/mdx-loader-remark-mdx-options
branch
from
September 24, 2026 16:15
e798cf9 to
31e76cb
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pre-flight checklist
Motivation
Make it possible to pass
remark-mdxoptions (for exampleacornOptions.ecmaVersion: 2025to parse import attributes). MDX'screateProcessor()can't take them (AI-assisted).We can't drop
createProcessor()for a hand-built pipeline: it relies on 5 internal plugins that@mdx-js/mdxdoesn't export (remarkMarkAndUnravel,rehypeRemoveRaw,recmaDocument,recmaJsxRewrite,recmaBuildJsxTransform), about 2k lines we'd have to vendor.Instead, for the
mdxformat we add[remarkMdx, options]toremarkPlugins. unified dedupes plugins by reference, so this reconfigures theremark-mdxattacher thatcreateProcessor()already registered, at its original position. The pipeline stays identical. Themdformat is untouched, since it doesn't useremark-mdx.remarkMdxOptions. It's not exposed in the site config or plugin options yet. When it's unset (the default), we don't add anything, so the pipeline is exactly whatcreateProcessor()builds.remark-mdxmoves fromdevDependenciestodependencies. If a user's install ends up with a second copy ofremark-mdx(different identity), unified can't dedupe, soremark-mdxwould be attached twice, but only when options are set. I tested this: output is unchanged, and the options still apply because micromark tries constructs from later extensions first. The cost is duplicate constructs.No behavior change expected.
Test Plan
ecmaVersion: 2025, and the option is ignored for themdformat.pnpm build:website:fastbefore and after the change. Once hashes are normalized, all 2519 output files are byte-identical except the debug-plugin content chunk. There, 2.tsxpages swapped places in the pages list, which comes from the pages plugin'sloadContentglob order, not MDX.sw.jschanges only through revision hashes.Test links
Deploy preview: https://deploy-preview-12484--docusaurus-2.netlify.app/
Related issues/PRs
🤖 Generated with Claude Code