Skip to content
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

gatsby-transformer-remark doesn't accept "engines" plugin option for graymatter #38879

Open
2 tasks done
amamenko opened this issue Feb 29, 2024 · 0 comments
Open
2 tasks done
Labels
status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer type: bug An issue or pull request relating to a bug in Gatsby

Comments

@amamenko
Copy link

Preliminary Checks

Description

From the Gatsby docs for gatsby-transformer-remark:

gray-matter options
gatsby-transformer-remark uses gray-matter to parse Markdown frontmatter, so you can specify any of the options mentioned in its README in the options key of the plugin.

One of the gray-matter options is options.engines. However, when I supply the engines field onto the gatsby-transformer-remark options like so:

{
    resolve: `gatsby-transformer-remark`,
    options: {
      engines: {
        yaml: {
          parse: (src: string, options: object) => {
            return parse(src, options);
          },
          stringify,
        },
      },
      footnotes: true,
      gfm: true
}

Gatsby throws a warning on build: warn Warning: there are unknown plugin options for "gatsby-transformer-remark": engines Please open an issue at https://ghub.io/gatsby-transformer-remark if you believe this option is valid. This should work and I am therefore filing this issue.

I also see the engines option is entirely missing from the Joi data validation schema of gatsby-transformer-remark in its gatsby-node:

return Joi.object({
    footnotes: Joi.boolean().description(`Activates Footnotes mode (default: true)`),
    gfm: Joi.boolean().description(`Activates GitHub Flavored Markdown mode (default: true)`),
    excerpt_separator: Joi.string().description(`If your Markdown file contains HTML, excerpt will not return a value. In that case, you can set an excerpt_separator to an HTML tag. Edit your Markdown files to include that HTML tag after the text you’d like to appear in the excerpt.`),
    plugins: Joi.subPlugins().description(`A list of remark plugins. See also: https://github.com/gatsbyjs/gatsby/tree/master/examples/using-remark for examples`),
    // TODO(v6): Remove and disallow any custom engines (including JS)
    jsFrontmatterEngine: Joi.boolean().default(false).description(`Enable JS for https://github.com/jonschlinkert/gray-matter#optionsengines`)
  })

Reproduction Link

https://codesandbox.io/p/devbox/withered-snow-c4lrxc

Steps to Reproduce

  1. Add "engines" field to gatsby-transformer-remark options in gatsby-config
  2. Run Gatsby build

Expected Result

No warning for custom engines for gatsby-transformer-remark

Actual Result

I received a build warning:

warn Warning: there are unknown plugin options for "gatsby-transformer-remark": engines
Please open an issue at https://ghub.io/gatsby-transformer-remark if you believe this option is valid.

Environment

System:
    OS: macOS 14.3.1
    CPU: (8) arm64 Apple M1
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 18.18.2 - ~/.nvm/versions/node/v18.18.2/bin/node
    Yarn: 1.22.19 - /opt/homebrew/bin/yarn
    npm: 9.8.1 - ~/.nvm/versions/node/v18.18.2/bin/npm
  Browsers:
    Chrome: 122.0.6261.69
    Safari: 17.3.1
  npmPackages:
    gatsby: ^5.13.1 => 5.13.1
    gatsby-plugin-postcss: ^6.13.0 => 6.13.0
    gatsby-plugin-sharp: ^5.13.0 => 5.13.0
    gatsby-source-filesystem: ^5.13.0 => 5.13.0
    gatsby-transformer-json: ^5.13.0 => 5.13.0
    gatsby-transformer-remark: ^6.13.0 => 6.13.0
  npmGlobalPackages:
    gatsby-cli: 5.13.2

Config Flags

No response

@amamenko amamenko added the type: bug An issue or pull request relating to a bug in Gatsby label Feb 29, 2024
@gatsbot gatsbot bot added the status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer label Feb 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer type: bug An issue or pull request relating to a bug in Gatsby
Projects
None yet
Development

No branches or pull requests

1 participant