-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
pass plugin options to setParserPlugin #3297
pass plugin options to setParserPlugin #3297
Conversation
some remark plugins require options to be passed to remark. for example, `remark.use(parserPlugin, requiredPlugin)`. This commit passes the pluginOptions to setParserPlugins. setParserPlugins returns an array of parsers. Now array elements can also be arrays of two elements: parser, and options.
Deploy preview ready! Built with commit 25f438f |
Deploy preview ready! Built with commit 3a0443f |
Probably the easiest way to test this is to build a plugin (e.g. gatsby-remark-custom-block) and PR it along with an example site. |
Thanks! Great stuff! |
Hiya @AlahmadiQ8! 👋 This is definitely late, but on behalf of the entire Gatsby community, I wanted to say thank you for being here. Gatsby is built by awesome people like you. Let us say “thanks” in two ways:
If you have questions, please don’t hesitate to reach out to us: tweet at @gatsbyjs and we’ll come a-runnin’. Thanks again! 💪💜 |
reference to #3280.
Description
Currently, there is no way to pass options to remark parser plugins through
setParserPlugins
. For example, I wasn't able to use remark-custom-blocks since it requires to pass options.This PR passes
pluginOptions
tosetParserPlugins
to solve this.Example Usage
Here is an example of how
gatsby-remark-custom-blocks
plugin would be written.and in
gatsby-config.js
, here is how we pass required parser options.Testing
tbh not sure how I would add tests for this. Any feedback/examples is appreciated.