Skip to content

Commit afb06d7

Browse files
bytrangleLekoArts
andauthored
chore(docs): Add hint for MDX plugin in remark-plugin-tutorial (#32876)
Co-authored-by: Lennart <lekoarts@gmail.com>
1 parent 1303ecb commit afb06d7

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

docs/tutorial/remark-plugin-tutorial.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,27 @@ If you want to add some options, you could switch to the object syntax:
164164
}
165165
```
166166

167+
### `gatsby-plugin-mdx`
168+
169+
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.
170+
171+
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`.
172+
173+
```js
174+
{
175+
resolve: `gatsby-plugin-mdx`,
176+
options: {
177+
gatsbyRemarkPlugins: [
178+
{
179+
resolve: require.resolve(`./plugins/gatsby-remark-purple-headers`),
180+
}
181+
]
182+
}
183+
}
184+
```
185+
186+
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`.
187+
167188
## Find and Modify Markdown Nodes
168189

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

0 commit comments

Comments
 (0)