62 line long comment results in Index out of bounds exception #627

Closed
opened 2026-01-29 14:41:28 +00:00 by claunia · 1 comment
Owner

Originally created by @SebastianRaffel on GitHub (Sep 7, 2023).

Markdown.Parse throws an Index was outside the bounds of the array. Exception when it parses a markdown comment that is exactly 62 lines long. Content does not seem to matter, and add or remove just one line fixes it.

Happens with markdig and markdig (advanced), 0.31.0

Babelmark

babelmark result with markdig

Markdown:

[diagram]: # (
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
a
)

Note
I did not want to comment out my 62 a; originally it was a mermaid diagram that happened to be 62 lines long.

Originally created by @SebastianRaffel on GitHub (Sep 7, 2023). `Markdown.Parse` throws an `Index was outside the bounds of the array.` _Exception_ when it parses a [markdown comment](https://stackoverflow.com/a/20885980) that is exactly 62 lines long. Content does not seem to matter, and add or remove just one line fixes it. Happens with **markdig** and **markdig (advanced)**, **0.31.0** [Babelmark](https://babelmark.github.io/?text=%23+Commented+mmermaid%0A%0A%5Bdiagram%5D%3A+%23+(%0Aa%0Aa%0Aa%0Aa%0Aa%0Aa%0Aa%0Aa%0Aa%0Aa%0Aa%0Aa%0Aa%0Aa%0Aa%0Aa%0Aa%0Aa%0Aa%0Aa%0Aa%0Aa%0Aa%0Aa%0Aa%0Aa%0Aa%0Aa%0Aa%0Aa%0Aa%0Aa%0Aa%0Aa%0Aa%0Aa%0Aa%0Aa%0Aa%0Aa%0Aa%0Aa%0Aa%0Aa%0Aa%0Aa%0Aa%0Aa%0Aa%0Aa%0Aa%0Aa%0Aa%0Aa%0Aa%0Aa%0Aa%0Aa%0Aa%0Aa%0Aa%0Aa%0A)%0A) ![babelmark result with markdig](https://github.com/xoofx/markdig/assets/63394251/f8fcf5f5-aad2-4890-8ed6-e09ebb9f50cc) Markdown: ```md [diagram]: # ( a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a ) ``` > Note > I did not want to comment out my 62 `a`; originally it was a mermaid diagram that happened to be 62 lines long.
claunia added the bug label 2026-01-29 14:41:28 +00:00
Author
Owner

@MihaZupan commented on GitHub (Sep 19, 2023):

This was fixed in 0.32.0 by #710

@MihaZupan commented on GitHub (Sep 19, 2023): This was fixed in `0.32.0` by #710
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/markdig#627