Skip to content

fix: dual remark-gfm versions for table compatibility#201

Open
gcutrini wants to merge 1 commit into
mainfrom
fix/remark-gfm-table-compatibility
Open

fix: dual remark-gfm versions for table compatibility#201
gcutrini wants to merge 1 commit into
mainfrom
fix/remark-gfm-table-compatibility

Conversation

@gcutrini
Copy link
Copy Markdown
Contributor

Summary

  • Downgrade remark-gfm to v3.0.1 for gatsby-plugin-mdx build pipeline
  • Add remark-gfm-4 (npm alias to remark-gfm@^4.0.1) for runtime MDX compilation
  • Update src/components/Mdx.js to import from remark-gfm-4

Context

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.0 being incompatible with remark-gfm v4's table AST nodes (gatsbyjs/gatsby#38789, mdx-js/mdx#2379).

However, src/components/Mdx.js uses evaluateSync from @mdx-js/mdx v3 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:

  • Build time (gatsby-plugin-mdx): remark-gfm v3.0.1, compatible with mdast-util-to-hast v10
  • Runtime (evaluateSync): remark-gfm-4 v4.0.1, compatible with @mdx-js/mdx v3

Commit history

remark-gfm@^4.0.0 was 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. evaluateSync was introduced in 372cb7f replacing deprecated @mdx-js/runtime, requiring v4.

ref: gatsbyjs/gatsby#38789
ref: mdx-js/mdx#2379

@gcutrini gcutrini requested a review from smarcet April 30, 2026 22:34
@netlify
Copy link
Copy Markdown

netlify Bot commented Apr 30, 2026

Deploy Preview for qa-fnvirtual ready!

Name Link
🔨 Latest commit cf458a2
🔍 Latest deploy log https://app.netlify.com/projects/qa-fnvirtual/deploys/69f3eb5587e30a000805fa36
😎 Deploy Preview https://deploy-preview-201--qa-fnvirtual.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@gcutrini gcutrini force-pushed the fix/remark-gfm-table-compatibility branch from 15a5bbb to 79dbb24 Compare April 30, 2026 22:39
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
@gcutrini gcutrini force-pushed the fix/remark-gfm-table-compatibility branch from 79dbb24 to cf458a2 Compare April 30, 2026 23:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant