fix: dual remark-gfm versions for table compatibility#201
Open
gcutrini wants to merge 1 commit into
Open
Conversation
✅ Deploy Preview for qa-fnvirtual ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
15a5bbb to
79dbb24
Compare
Downgrade remark-gfm to v3.0.1 for gatsby-plugin-mdx build pipeline (v4 is incompatible with gatsby-plugin-mdx's mdast-util-to-hast v10, causing "inTable" errors on GFM table syntax). Add remark-gfm-4 (npm:remark-gfm@^4.0.1) for runtime MDX compilation via evaluateSync in Mdx.js (used by CMS preview and marketing pages), which requires v4 for its unified v11 pipeline. ref: gatsbyjs/gatsby#38789 ref: mdx-js/mdx#2379
79dbb24 to
cf458a2
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.
Summary
remark-gfmto v3.0.1 for gatsby-plugin-mdx build pipelineremark-gfm-4(npm alias to remark-gfm@^4.0.1) for runtime MDX compilationsrc/components/Mdx.jsto import fromremark-gfm-4Context
GFM markdown tables fail to compile with gatsby-plugin-mdx v5 + remark-gfm v4 due to gatsby-plugin-mdx's internal
mdast-util-to-hast@^10.2.0being incompatible with remark-gfm v4's table AST nodes (gatsbyjs/gatsby#38789, mdx-js/mdx#2379).However,
src/components/Mdx.jsusesevaluateSyncfrom@mdx-js/mdxv3 for runtime MDX compilation (CMS preview + marketing pages), which requires remark-gfm v4 (v3 fails with "this.setData is not a function").The dual version approach resolves both:
remark-gfmv3.0.1, compatible with mdast-util-to-hast v10remark-gfm-4v4.0.1, compatible with @mdx-js/mdx v3Commit history
remark-gfm@^4.0.0was added in 7e6ff31 when migrating from gatsby-transformer-remark to gatsby-plugin-mdx. The v4 incompatibility wasn't caught because no content pages used markdown tables at the time.evaluateSyncwas introduced in 372cb7f replacing deprecated@mdx-js/runtime, requiring v4.ref: gatsbyjs/gatsby#38789
ref: mdx-js/mdx#2379