-
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
Can't bind plugin via setParserPlugins option with gatsby-transform-remark #8009
Comments
Hi @vadimshvetsov, we'll look into this. |
@vadimshvetsov can you share repository where you try to implement it, so we could take a look at how you doing and reproduce it locally |
I've tried to implement everything in PR #8044 but I'm not fluent with gatsby. I'd like to get any advices about what I'm doing wrong. |
What actually happens when You run it like that @vadimshvetsov? Like - what's the console/terminal output? Does it show errors? |
@pieh I've moved package from local plugin to gatsby repo package and trying to make it works. At this moment my workflow is following:
But |
I've tried to spread some console logs inside for (let plugin of pluginOptions.plugins) {
console.log(`-------------------------`)
console.log(`PLUGIN`, JSON.stringify(plugin, null, 4))
console.log(`-------------------------`)
const requiredPlugin = require(plugin.resolve)
console.log(`-------------------------`)
console.log(`REQUIRED PLUGIN`, JSON.stringify(requiredPlugin, null, 4))
console.log(`-------------------------`)
if (_.isFunction(requiredPlugin.setParserPlugins)) {
console.log(`-------------------------`)
console.log(`HAS SET_PARSER_PLUGINS`, JSON.stringify(requiredPlugin, null, 4))
console.log(`-------------------------`)
for (let parserPlugin of requiredPlugin.setParserPlugins(
plugin.pluginOptions
)) {
console.log(`-------------------------`)
console.log(`PARSER PLUGIN`, JSON.stringify(parserPlugin, null, 4))
console.log(`-------------------------`)
if (_.isArray(parserPlugin)) {
const [parser, options] = parserPlugin
remark = remark.use(parser, options)
} else {
remark = remark.use(parserPlugin)
}
}
}
} And I have the following logs when processing with my
|
At this moment it looks like this
gatsby/packages/gatsby-transformer-remark/src/extend-node-type.js Lines 83 to 97 in 4386750
I've tried to use already published |
I can't find out why the tests are passing locally but in Travis there is an obsolete snapshot. I've ran several times |
I will close this one until I'll bind remark-bracketed-spans with gatsby-tranform-remark. It can't work with only setParserPlugin, I will try to find out why |
Summary
I want to have an opportunity to use an
id
orclass
attributes in my markdown pages with this syntax:That's when a remark-bracketed-spans markdown parser plugin comes in.
I'm stuck at making it works together with
gatsby-transform-remark
localy. What am I doing wrong?Relevant information
Issue #3297 was closed with great a PR adding setParserPlugins option and I want leverage this with
gatsby-remark-bracketed-spans
plugin. May be it can't work with local plugin? But I can't see why when following the source.gatsby/packages/gatsby-transformer-remark/src/extend-node-type.js
Lines 83 to 97 in 4386750
Another example is
gatsby-remark-katex
. At the bottom of theindex.js
array returns with one parser plugin within -remark-math
:gatsby/packages/gatsby-remark-katex/src/index.js
Line 21 in 445f5ff
Environment
npmPackages:
...
gatsby: next => 2.0.0-rc.15
gatsby-transformer-remark: next => 2.1.1-rc.1
...
File contents
In main project:
gatsby-config.js
:In folder
/plugins/gatsby-remark-bracketed-spans/
package.json
:index.js
:The text was updated successfully, but these errors were encountered: