Bug when parsing List inside QuoteBlock #751

Open
opened 2026-01-29 14:44:46 +00:00 by claunia · 0 comments
Owner

Originally created by @kuiperzone on GitHub (Aug 14, 2025).

Where testing Markdig with some samples, I found a bug when handling lists inside quoted blocks.

VERSION: Markdig.Signed Version="0.41.3"

I can tell you that the bug seems to be in the parsing of the source text, rather than in the HTML generation.

Here's the code to reproduce:

        var src = @"
> >* _Unordered 1_ QL2 level 1 no space sep
> >  Continued 1
> > * Unordered 2 level 1
> > 1. **Ordered 1** QL2 level 1
> >    Continued 1
> > > Not continued QL3
> > 2. Ordered 2 QL2 level 1
> > Continued 2a
> >
> >    Continued 2b
> >
> >    Continued 2c
> >
> >    3. Ordered 3 QL2 level 2
> >       Continued 3a
> >
> >       Continued 3b
        ";

        var a = Markdig.Markdown.ToHtml(src);
        Console.WriteLine(a);

This is the HTML output of Markdig. It is incorrect at the line "Not Continued QL3":

<blockquote>
<blockquote>
<ul>
<li><em>Unordered 1</em> QL2 level 1 no space sep
Continued 1</li>
<li>Unordered 2 level 1</li>
</ul>
<ol>
<li><strong>Ordered 1</strong> QL2 level 1
Continued 1</li>
</ol>
<blockquote>
<p>Not continued QL3
2. Ordered 2 QL2 level 1 <-- ERROR HERE
Continued 2a</p>
</blockquote>
<p>Continued 2b</p>
<p>Continued 2c</p>
<ol start="3">
<li><p>Ordered 3 QL2 level 2
Continued 3a</p>
<p>Continued 3b</p>
</li>
</ol>
</blockquote>
</blockquote>

Here is the output from "Try It" web page on CommonMark:

blockquote>
<blockquote>
<ul>
<li><em>Unordered 1</em> QL2 level 1 no space sep
Continued 1</li>
<li>Unordered 2 level 1</li>
</ul>
<ol>
<li><strong>Ordered 1</strong> QL2 level 1
Continued 1</li>
</ol>
<blockquote>
<p>Not continued QL3</p>
</blockquote>
<ol start="2">
<li>
<p>Ordered 2 QL2 level 1
Continued 2a</p>
<p>Continued 2b</p>
<p>Continued 2c</p>
<ol start="3">
<li>
<p>Ordered 3 QL2 level 2
Continued 3a</p>
<p>Continued 3b</p>
</li>
</ol>
</li>
</ol>
</blockquote>
</blockquote>
Originally created by @kuiperzone on GitHub (Aug 14, 2025). Where testing Markdig with some samples, I found a bug when handling lists inside quoted blocks. VERSION: Markdig.Signed Version="0.41.3" I can tell you that the bug seems to be in the parsing of the source text, rather than in the HTML generation. Here's the code to reproduce: ```csharp var src = @" > >* _Unordered 1_ QL2 level 1 no space sep > > Continued 1 > > * Unordered 2 level 1 > > 1. **Ordered 1** QL2 level 1 > > Continued 1 > > > Not continued QL3 > > 2. Ordered 2 QL2 level 1 > > Continued 2a > > > > Continued 2b > > > > Continued 2c > > > > 3. Ordered 3 QL2 level 2 > > Continued 3a > > > > Continued 3b "; var a = Markdig.Markdown.ToHtml(src); Console.WriteLine(a); ``` This is the HTML output of Markdig. It is incorrect at the line "Not Continued QL3": ``` <blockquote> <blockquote> <ul> <li><em>Unordered 1</em> QL2 level 1 no space sep Continued 1</li> <li>Unordered 2 level 1</li> </ul> <ol> <li><strong>Ordered 1</strong> QL2 level 1 Continued 1</li> </ol> <blockquote> <p>Not continued QL3 2. Ordered 2 QL2 level 1 <-- ERROR HERE Continued 2a</p> </blockquote> <p>Continued 2b</p> <p>Continued 2c</p> <ol start="3"> <li><p>Ordered 3 QL2 level 2 Continued 3a</p> <p>Continued 3b</p> </li> </ol> </blockquote> </blockquote> ``` Here is the output from "Try It" web page on CommonMark: ``` blockquote> <blockquote> <ul> <li><em>Unordered 1</em> QL2 level 1 no space sep Continued 1</li> <li>Unordered 2 level 1</li> </ul> <ol> <li><strong>Ordered 1</strong> QL2 level 1 Continued 1</li> </ol> <blockquote> <p>Not continued QL3</p> </blockquote> <ol start="2"> <li> <p>Ordered 2 QL2 level 1 Continued 2a</p> <p>Continued 2b</p> <p>Continued 2c</p> <ol start="3"> <li> <p>Ordered 3 QL2 level 2 Continued 3a</p> <p>Continued 3b</p> </li> </ol> </li> </ol> </blockquote> </blockquote> ```
claunia added the bugPR Welcome! labels 2026-01-29 14:44:46 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/markdig#751