remarkjs / remark-directive

remark plugin to support directives

Home Page:https://remark.js.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

"error Cannot process file [cause]: TypeError: chunks[startIndex].slice is not a function" parsing Markdown with unclosed directive syntax

DavidAnson opened this issue · comments

Initial checklist

Affected packages and versions

remark-cli@12.0.1, remark-directive@3.0.0

Link to runnable example

No response

Steps to reproduce

See underlying micromark issue for context: micromark/micromark#173

I've opened this separate issue for the awareness of the folks who maintain remark.

user@HOST mmi % npm ls
mmi@ /Users/user/Documents/mmi
├── micromark-extension-directive@3.0.0
├── micromark@4.0.0
├── remark-cli@12.0.1
└── remark-directive@3.0.0

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 %

Expected behavior

Can process file

Actual behavior

Cannot process file (see above)

Runtime

Node v17

Package manager

npm 8

OS

macOS

Build and bundle tools

Other (please specify in steps to reproduce)

Possibly a duplicate of the continuation error from micromark/micromark-extension-directive#16

I've opened this separate issue for the awareness of the folks who maintain remark.

For reference, pretty much the same team.

Closing this copy as it is an issue in a lower level dependency.

Hi! Thanks for taking the time to contribute!

Because we treat issues as our backlog, we close duplicates to focus our work and not have to touch the same chunk of code for the same reason multiple times. This is also why we may mark something as duplicate that isn’t an exact duplicate but is closely related.

Thanks,
— bb

Hi! This was closed. Team: If this was fixed, please add phase/solved. Otherwise, please add one of the no/* labels.

Hi team! It seems this post is a duplicate, but hasn’t been marked as such. Please post a comment w/ Duplicate of #123(no final .) to do so. See GH docs for more info.

Thanks,
— bb