Skip to content

Commit

Permalink
chore(docs): Add hint for MDX plugin in remark-plugin-tutorial (#32876)
Browse files Browse the repository at this point in the history
Co-authored-by: Lennart <[email protected]>
  • Loading branch information
bytrangle and LekoArts authored Aug 26, 2021
1 parent 1303ecb commit afb06d7
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions docs/tutorial/remark-plugin-tutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,27 @@ If you want to add some options, you could switch to the object syntax:
}
```

### `gatsby-plugin-mdx`

In case you use `gatsby-plugin-mdx` in place of `gatsby-transformer-remark`, the former takes an array config option named `gatsbyRemarkPlugins` that allows compatibility with Gatsby's remark plugins.

To make `gatsby-plugin-mdx` recognize a local plugin like `gatsby-remark-purple-headers`, you need to point to its location in the project through `require.resolve`.

```js
{
resolve: `gatsby-plugin-mdx`,
options: {
gatsbyRemarkPlugins: [
{
resolve: require.resolve(`./plugins/gatsby-remark-purple-headers`),
}
]
}
}
```

However, if the sub-plugin is published and installed via npm, simply refer to it by name as the case with using `gatsby-transformer-remark`.

## Find and Modify Markdown Nodes

When modifying nodes, you'll want to walk the tree and then implement new functionality on specific nodes.
Expand Down

0 comments on commit afb06d7

Please sign in to comment.