-
-
Notifications
You must be signed in to change notification settings - Fork 60
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
"TypeError: chunks[startIndex].slice is not a function" during call to postprocess when used with micromark-extension-directive #173
Labels
🤞 phase/open
Post is being triaged manually
Comments
github-actions
bot
added
👋 phase/new
Post is being triaged automatically
🤞 phase/open
Post is being triaged manually
and removed
👋 phase/new
Post is being triaged automatically
labels
May 18, 2024
DavidAnson
changed the title
"TypeError: chunks[startIndex].slice is not a function" during post process when used with micromark-extension-directive
"TypeError: chunks[startIndex].slice is not a function" during call to postprocess when used with micromark-extension-directive
May 18, 2024
Please note that unlike the previous/similar issue, it is not necessary for the caller to walk const chunks = preprocess()(markdown, encoding, end);
const parseContext = parse(options).document().write(chunks);
postprocess(parseContext); // crashes in this call |
And actually, the same crash can be reproduced via user@HOST mmi % npm ls
mmi@ /Users/user/Documents/mmi
├── [email protected]
├── [email protected]
├── [email protected]
└── [email protected]
user@HOST mmi % cat bug.md
* some text
:::note
a%
user@HOST mmi % ./node_modules/.bin/remark bug.md --use remark-directive
bug.md
error Cannot process file
[cause]:
TypeError: chunks[startIndex].slice is not a function
at sliceChunks (file:///Users/user/Documents/mmi/node_modules/micromark/lib/create-tokenizer.js:512:32)
at Object.sliceStream (file:///Users/user/Documents/mmi/node_modules/micromark/lib/create-tokenizer.js:153:12)
at subcontent (file:///Users/user/Documents/mmi/node_modules/micromark-util-subtokenize/index.js:150:24)
at subtokenize (file:///Users/user/Documents/mmi/node_modules/micromark-util-subtokenize/index.js:71:30)
at postprocess (file:///Users/user/Documents/mmi/node_modules/micromark/lib/postprocess.js:12:11)
at fromMarkdown (file:///Users/user/Documents/mmi/node_modules/mdast-util-from-markdown/lib/index.js:174:5)
at parser (file:///Users/user/Documents/mmi/node_modules/remark-parse/lib/index.js:33:12)
at Function.parse (file:///Users/user/Documents/mmi/node_modules/unified/lib/index.js:668:12)
at parse (file:///Users/user/Documents/mmi/node_modules/unified-engine/lib/file-pipeline/parse.js:59:36)
at wrapped (file:///Users/user/Documents/mmi/node_modules/trough/lib/index.js:160:27)
✖ 1 error
user@HOST mmi % |
Possibly a duplicate of the continuation error from micromark/micromark-extension-directive#16 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Initial checklist
Affected packages and versions
[email protected], [email protected]
Link to runnable example
No response
Steps to reproduce
Expected behavior
No Error thrown.
Please see very related #131 for a similar micromark issue that was raised and fixed in January of 2023.
Please see DavidAnson/markdownlint-cli2#325 for the user report of this problem happening with the markdownlint library. I've included all 4 scenarios in the sample code here, though I expect they're all the same underlying issue.
Note that un-indenting the
:::
line avoids the problem.Actual behavior
Error, see above.
Runtime
Node v16
Package manager
npm v7
OS
macOS
Build and bundle tools
Other (please specify in steps to reproduce)
The text was updated successfully, but these errors were encountered: