gatsby-ssr.js for a remark plugin not being picked up

Created on 6 Jan 2020  路  1Comment  路  Source: gatsbyjs/gatsby

Description

When attempting to add gatsby-remark-autolink-headers to a gatsby site based on gatsby-gitbook-starter, the plugin inserts link svgs as expected, but the CSS is not present.

Steps to reproduce

  • Start a new project with gatsby-gitbook-starter
  • Add gatsby-remark-autolink-headers to options.gatsbyRemarkPlugins for gatsby-plugin-mdx in gatsby-config.js

Expected result

style and script tags should be injected into the page's head via the plugin's gatsby-ssr.js

Actual result

The plugin's gatsby-ssr.js is never executed, no css and script tags are added to style to new anchor icons.

Environment

System:
OS: macOS 10.15.1
CPU: (4) x64 Intel(R) Core(TM) i5-7360U CPU @ 2.30GHz
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 12.1.0 - ~/.nvm/versions/node/v12.1.0/bin/node
Yarn: 1.15.2 - ~/.nvm/versions/node/v12.1.0/bin/yarn
npm: 6.9.0 - ~/.nvm/versions/node/v12.1.0/bin/npm
Languages:
Python: 2.7.16 - /usr/local/bin/python
Browsers:
Chrome: 79.0.3945.88
Firefox: 69.0
Safari: 13.0.3
npmPackages:
gatsby: 2.18.18 => 2.18.18
gatsby-link: 2.2.27 => 2.2.27
gatsby-plugin-algolia: 0.5.0 => 0.5.0
gatsby-plugin-catch-links: ^2.1.21 => 2.1.21
gatsby-plugin-emotion: 4.1.18 => 4.1.18
gatsby-plugin-gtag: 1.0.12 => 1.0.12
gatsby-plugin-layout: 1.1.18 => 1.1.18
gatsby-plugin-manifest: 2.2.33 => 2.2.33
gatsby-plugin-mdx: 1.0.61 => 1.0.61
gatsby-plugin-offline: 3.0.29 => 3.0.29
gatsby-plugin-react-helmet: 3.1.18 => 3.1.18
gatsby-plugin-remove-serviceworker: 1.0.0 => 1.0.0
gatsby-plugin-remove-trailing-slashes: 2.1.17 => 2.1.17
gatsby-plugin-sharp: 2.3.7 => 2.3.7
gatsby-plugin-sitemap: 2.2.24 => 2.2.24
gatsby-remark-autolink-headers: 2.1.22 => 2.1.22
gatsby-remark-copy-linked-files: 2.1.33 => 2.1.33
gatsby-remark-images: 3.1.37 => 3.1.37
gatsby-source-filesystem: 2.1.42 => 2.1.42
gatsby-transformer-remark: 2.6.42 => 2.6.42
npmGlobalPackages:
gatsby-cli: 2.8.22
gatsby: 2.18.17

bug

Most helpful comment

Thank you for opening this!

I cloned https://github.com/gatsbyjs/gatsby-starter-blog-theme and edited out the remark-slug parts (added here: https://github.com/gatsbyjs/gatsby/pull/14520) which were added due to: https://github.com/ChristopherBiscardi/gatsby-mdx/issues/204

I "fixed" the issue by also adding the plugin to plugins:

options: {
  extensions: [`.mdx`, `.md`],
  gatsbyRemarkPlugins: [
    { resolve: `gatsby-remark-autolink-headers` },
  ],
  plugins: [`gatsby-remark-autolink-headers`]
},

This is the same as: https://github.com/gatsbyjs/gatsby/issues/15486

We're marking this issue as answered and closing it for now but please feel free to comment here if you would like to continue this discussion. We also recommend heading over to our communities if you have questions that are not bug reports or feature requests. We hope we managed to help and thank you for using Gatsby!

>All comments

Thank you for opening this!

I cloned https://github.com/gatsbyjs/gatsby-starter-blog-theme and edited out the remark-slug parts (added here: https://github.com/gatsbyjs/gatsby/pull/14520) which were added due to: https://github.com/ChristopherBiscardi/gatsby-mdx/issues/204

I "fixed" the issue by also adding the plugin to plugins:

options: {
  extensions: [`.mdx`, `.md`],
  gatsbyRemarkPlugins: [
    { resolve: `gatsby-remark-autolink-headers` },
  ],
  plugins: [`gatsby-remark-autolink-headers`]
},

This is the same as: https://github.com/gatsbyjs/gatsby/issues/15486

We're marking this issue as answered and closing it for now but please feel free to comment here if you would like to continue this discussion. We also recommend heading over to our communities if you have questions that are not bug reports or feature requests. We hope we managed to help and thank you for using Gatsby!

Was this page helpful?
0 / 5 - 0 ratings