A list with empty lines extends into the next paragraph. #717

Closed
opened 2026-01-29 14:43:46 +00:00 by claunia · 2 comments
Owner

Originally created by @snnz on GitHub (Jan 3, 2025).

Noticed this while looking at the test samples in #839.

CommonMark spec states that a list item can begin with at most one blank line. Example 280 demonstrates this.

var result = Markdown.ToHtml("-\n\n  foo");

The result is:

<ul>
<li></li>
</ul>
<p>foo</p>

If one more empty item is added

var result = Markdown.ToHtml("-\n-\n\n  foo");

Everything is as expected again:

<ul>
<li></li>
<li></li>
</ul>
<p>foo</p>

But if a blank line is inserted between the items:

var result = Markdown.ToHtml("-\n\n-\n\n  foo");

The result is suddenly

<ul>
<li></li>
<li><p>foo</p></li>
</ul>

Isn't this strange?

Originally created by @snnz on GitHub (Jan 3, 2025). Noticed this while looking at the test samples in #839. CommonMark spec states that a list item can begin with at most one blank line. [Example 280](https://spec.commonmark.org/0.31.2/#example-280) demonstrates this. ```csharp var result = Markdown.ToHtml("-\n\n foo"); ``` The result is: ``` <ul> <li></li> </ul> <p>foo</p> ``` If one more empty item is added ```csharp var result = Markdown.ToHtml("-\n-\n\n foo"); ``` Everything is as expected again: ``` <ul> <li></li> <li></li> </ul> <p>foo</p> ``` But if a blank line is inserted between the items: ```csharp var result = Markdown.ToHtml("-\n\n-\n\n foo"); ``` The result is suddenly ``` <ul> <li></li> <li><p>foo</p></li> </ul> ``` Isn't this strange?
claunia added the bugPR Welcome! labels 2026-01-29 14:43:46 +00:00
Author
Owner

@xoofx commented on GitHub (Feb 2, 2025):

Repro here

Isn't this strange?

Yes, it's probably a bug.

@xoofx commented on GitHub (Feb 2, 2025): Repro [here](https://babelmark.github.io/?text=-%0A%0A-%0A%0A++foo%0A) > Isn't this strange? Yes, it's probably a bug.
Author
Owner

@MihaZupan commented on GitHub (Oct 20, 2025):

This one presumably got fixed by #888 with the 0.42.0 release.

@MihaZupan commented on GitHub (Oct 20, 2025): This one presumably got fixed by #888 with the 0.42.0 release.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/markdig#717