I am using a tokenizer for remark and hitting this issue.
When running this package at this commit:
https://github.com/ryanpcmcquen/inkdrop_wiki_links/commit/9f296f6962723f05c530927b2c53256997644454
Changing the regex from:
const RE_WIKI = /\[([^\]]+)\]{2}/gm;
To:
const RE_WIKI = /\[([^\[\]]+)\]{2}/gm;
Brings out the error seen below.
Values would be parsed.
app:error Failed to render preview: +0ms Error: Incorrectly eaten value: please report this warning on https://git.io/vg5Ft
at validateEat (/Applications/Inkdrop.app/Contents/Resources/app.asar/app/static/node_modules/remark-parse/lib/tokenizer.js:151:17)
at eat (/Applications/Inkdrop.app/Contents/Resources/app.asar/app/static/node_modules/remark-parse/lib/tokenizer.js:236:13)
at Of.tokenizer (/Users/ry/code/inkdrop_wiki_links/lib/wiki_link_parser.js:25:20)
at Of.tokenize [as tokenizeInline] (/Applications/Inkdrop.app/Contents/Resources/app.asar/app/static/node_modules/remark-parse/lib/tokenizer.js:62:24)
at Of.paragraph (/Applications/Inkdrop.app/Contents/Resources/app.asar/app/static/node_modules/remark-parse/lib/tokenize/paragraph.js:96:26)
at Of.tokenize [as tokenizeBlock] (/Applications/Inkdrop.app/Contents/Resources/app.asar/app/static/node_modules/remark-parse/lib/tokenizer.js:62:24)
at Of.parse (/Applications/Inkdrop.app/Contents/Resources/app.asar/app/static/node_modules/remark-parse/lib/parse.js:33:26)
at Function.parse (/Applications/Inkdrop.app/Contents/Resources/app.asar/app/static/node_modules/unified/index.js:281:51)
at pipelineParse (/Applications/Inkdrop.app/Contents/Resources/app.asar/app/static/node_modules/unified/index.js:23:22)
at wrapped (/Applications/Inkdrop.app/Contents/Resources/app.asar/app/static/node_modules/trough/wrap.js:25:25)
at next (/Applications/Inkdrop.app/Contents/Resources/app.asar/app/static/node_modules/trough/index.js:57:30)
at Object.run (/Applications/Inkdrop.app/Contents/Resources/app.asar/app/static/node_modules/trough/index.js:31:16)
at executor (/Applications/Inkdrop.app/Contents/Resources/app.asar/app/static/node_modules/unified/index.js:375:22)
at Function.process (/Applications/Inkdrop.app/Contents/Resources/app.asar/app/static/node_modules/unified/index.js:370:11)
at /Applications/Inkdrop.app/Contents/Resources/app.asar/browser-exports.js:1:7012
at new Promise (<anonymous>)
at f.render (/Applications/Inkdrop.app/Contents/Resources/app.asar/browser-exports.js:1:6990)
at file:///Applications/Inkdrop.app/Contents/Resources/app.asar/browser-commons.js:1:60256
at /Applications/Inkdrop.app/Contents/Resources/app.asar/app/static/node_modules/redux-thunk/lib/index.js:11:24
at Object.dispatch (file:///Applications/Inkdrop.app/Contents/Resources/app.asar/browser-main.js:4:559855)
at file:///Applications/Inkdrop.app/Contents/Resources/app.asar/browser-main.js:4:155538
at /Applications/Inkdrop.app/Contents/Resources/app.asar/app/static/node_modules/lodash/lodash.js:2750:49
at __trace__ (/Applications/Inkdrop.app/Contents/Resources/app.asar/app/static/node_modules/@bugsnag/browser/dist/bugsnag.js:2231:34)
@ryanpcmcquen sorry you ran into some trouble, a few questions and thoughts:
@ChristianMurphy, got the versions:
"unified": "^9.2.0",
"remark-parse": "^8.0.3",
"remark-rehype": "^7.0.0",
I can move this to discussions. Shortcodes are meant to expand where I actually want linking functionality, plus they seem intended for blocks while I probably want _only_ inline parsing.
But, there is this that I could look into:
Hi there!
This is not a remark bug. This is a bug in the plugin you鈥檙e making. It鈥檚 surfacing in remark, because it doesn鈥檛 know what to do with it. The bug is that you鈥檙e supposed to tokenize something at the start of value, and not tokenize when it鈥檚 somewhere else in the document, but your regex is global so that鈥檚 probably happening.
We鈥檙e on a new parser now though, so I wouldn鈥檛 put much time in making something for an older version.
And this looks like remark-wiki-links as you say, which had a version for the old parser, and is already updated to support the new parser.
I鈥檇 suggest using that instead!
Thanks!
Most helpful comment
Hi there!
This is not a remark bug. This is a bug in the plugin you鈥檙e making. It鈥檚 surfacing in remark, because it doesn鈥檛 know what to do with it. The bug is that you鈥檙e supposed to tokenize something at the start of
value, and not tokenize when it鈥檚 somewhere else in the document, but your regex is global so that鈥檚 probably happening.We鈥檙e on a new parser now though, so I wouldn鈥檛 put much time in making something for an older version.
And this looks like
remark-wiki-linksas you say, which had a version for the old parser, and is already updated to support the new parser.I鈥檇 suggest using that instead!