markdownlint-cli2 icon indicating copy to clipboard operation
markdownlint-cli2 copied to clipboard

Crash of markdownlint-cli2 and vscode-markdownlint on invalid markdown

Open lukep-coxauto opened this issue 1 year ago • 2 comments

Ran a big codebase of markdown through the linter, and found an edge case that results in the parser crashing and unable to process the remainder of the files for linting. This happens both from the cli version and the vscode version (since it seems like the vscode one just uses this lib internally)

Output from linter is:

[1:27:05 PM] ERROR: Exception while linting with markdownlint-cli2:
TypeError: e[n].slice is not a function

example markdown that reproduces:

1. some text
   :::note

inner text

:::

2. some more text

It appears to be related to a :::note style callout existing within an ordered list.

Some more versions that reproduce the crash:

- some text
   :::note

inner text

:::

- some more text
* some text
   :::note

inner text
:::
* some text
   :::note

a

lukep-coxauto avatar May 16 '24 20:05 lukep-coxauto

Thank you for reporting this! It looks like an issue with the micromark parsing library. I've opened an issue for them here: https://github.com/micromark/micromark/issues/173.

DavidAnson avatar May 18 '24 06:05 DavidAnson

I've made a PR to the micromark-extension-directive project which should prevent this crash once merged, released, and incorporated: https://github.com/micromark/micromark-extension-directive/pull/27

DavidAnson avatar Sep 18 '24 17:09 DavidAnson

v0.15.0

DavidAnson avatar Nov 09 '24 23:11 DavidAnson