Skip to content

Bug when parsing List inside QuoteBlock #887

@kuiperzone

Description

@kuiperzone

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>

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions