Skip to content
This repository has been archived by the owner on Nov 3, 2019. It is now read-only.

Commit

Permalink
Allow gatsbyRemarkPlugins string reference (#326)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexandernanberg authored and ChristopherBiscardi committed Mar 29, 2019
1 parent 36f8fb5 commit 05b22da
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 12 deletions.
6 changes: 3 additions & 3 deletions examples/custom-remark-plugins/gatsby-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,16 @@ module.exports = {
),
remarkPlugins: [require("remark-toc")],
gatsbyRemarkPlugins: [
{ resolve: `gatsby-remark-katex` },
"gatsby-remark-katex",
{
resolve: "gatsby-remark-images",
options: {
maxWidth: 1035,
sizeByPixelDensity: true
}
},
{ resolve: "gatsby-remark-autolink-headers" },
{ resolve: "gatsby-remark-prismjs", options: {} }
"gatsby-remark-autolink-headers",
"gatsby-remark-prismjs"
]
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,3 @@ gatsbyRemarkPlugins: [
}
];
```

# Not

Using a string reference is currently not supported for `gatsbyRemarkPlugins`. (A PR would be accepted for this).

```js
gatsbyRemarkPlugins: [
`gatsby-remark-images`,
];
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ module.exports = async function getSourcePluginsAsRemarkPlugins({

// return list of remarkPlugins
const userPlugins = gatsbyRemarkPlugins
.map(plugin => (_.isString(plugin) ? { resolve: plugin } : plugin))
.filter(plugin => {
if (_.isFunction(require(plugin.resolve))) {
return true;
Expand Down

0 comments on commit 05b22da

Please sign in to comment.