DavidAnson / markdownlint-cli2

A fast, flexible, configuration-based command-line interface for linting Markdown/CommonMark files with the markdownlint library
MIT License
289 stars 41 forks source link

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

Open lukep-coxauto opened 1 month ago

lukep-coxauto commented 1 month ago

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
DavidAnson commented 1 month ago

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.