Skip to content

Commit

Permalink
fix(gatsby-plugin-mdx): Pass node API helpers through mdx-loader to r…
Browse files Browse the repository at this point in the history
…emark plugins (#21211)

* Pass node API helpers through mdx-loader

* Fix parse error
  • Loading branch information
andrewbranch committed Feb 10, 2020
1 parent 1060d72 commit 247a183
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/gatsby-plugin-mdx/gatsby/create-webpack-config.js
Expand Up @@ -75,6 +75,7 @@ module.exports = (
loader: path.join(`gatsby-plugin-mdx`, `loaders`, `mdx-loader`),
options: {
cache: cache,
actions: actions,
...other,
pluginOptions: options,
},
Expand Down
2 changes: 2 additions & 0 deletions packages/gatsby-plugin-mdx/loaders/mdx-loader.js
Expand Up @@ -97,6 +97,7 @@ module.exports = async function(content) {
cache,
pathPrefix,
pluginOptions,
...helpers
} = getOptions(this)

const options = withDefaultOptions(pluginOptions)
Expand Down Expand Up @@ -161,6 +162,7 @@ ${contentWithoutFrontmatter}`
}

const { rawMDXOutput } = await genMdx({
...helpers,
isLoader: true,
options,
node: { ...mdxNode, rawBody: code },
Expand Down

0 comments on commit 247a183

Please sign in to comment.