Skip to content

[gatsby-plugin-mdx] Frontmatter shows up in page content #35901

@karlhorky

Description

@karlhorky

Preliminary Checks

Description

After upgrading from [email protected] to [email protected], we're seeing our Frontmatter code show up in the content of the page 😱

Screen Shot 2022-06-04 at 20 14 57

This appears regardless of whether we have the JSFrontmatterEngine set to true or unconfigured...

cc @pieh @GeeWizWow


Workaround

A solution for gatsby build (SSG) requires reverting the change made by @pieh in #35830:

  1. Commenting out passing all options to gray-matter in the mdx-loader.js, utils/mdx.js, utils/gen-mdx.js files (using patch-package)
  2. And then ALSO enabling the JSFrontmatterEngine option

Super strange, wonder what's causing this Frontmatter to show up in the content.

Reproduction Link

https//.com/karlhorky/gatsby-mdx-frontmatter-bug

Steps to Reproduce

  1. Upgrade existing project from [email protected] to [email protected]
  2. Run gatsby develop or gatsby build
  3. Observe Frontmatter in the page content

Expected Result

No Frontmatter in the page content

Actual Result

Frontmatter displayed in the page content

Environment

System:
    OS: macOS 12.4
    CPU: (8) arm64 Apple M1
    Shell: 5.8.1 - /bin/zsh
  Binaries:
    Node: 16.11.0 - /var/folders/sw/v93sywxs2g1bcsr6ln488qfh0000gn/T/yarn--1654793941511-0.7489250249814705/node
    Yarn: 1.22.19 - /var/folders/sw/v93sywxs2g1bcsr6ln488qfh0000gn/T/yarn--1654793941511-0.7489250249814705/yarn
    npm: 8.7.0 - ~/.nvm/versions/node/v16.11.0/bin/npm
  Browsers:
    Chrome: 102.0.5005.61
    Firefox: 99.0.1
    Safari: 15.5

Config Flags

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    topic: remark/mdxRelated to Markdown, remark & MDX ecosystemtype: bugAn issue or pull request relating to a bug in Gatsby

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions