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

chore(docs): Add hint for MDX plugin in remark-plugin-tutorial #32876

Merged
merged 2 commits into from
Aug 26, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Add guide for gatsby-plugin-mdx
  • Loading branch information
bytrangle committed Aug 23, 2021
commit 2387eabd1c9ed798425bdb3d8638ad7c30883236
19 changes: 19 additions & 0 deletions docs/tutorial/remark-plugin-tutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,25 @@ If you want to add some options, you could switch to the object syntax:
}
```

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 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`),
}
]
}
}
```

On the other hand, 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