vmg / sundown

Standards compliant, fast, secure markdown processing library in C
1.99k stars 385 forks source link

Misparsed blockquote in list #61

Closed finsprings closed 12 years ago

finsprings commented 12 years ago

The blockquote in the list below is not parsed: the ">" is rendered when it should not be. @gruber's Markdown.pl does render it as a blockquote.

Tested at a40cdb9ece259d35aa4b3f8bb7efdcac9bb82109.

1.  Hello
1.  World
> A blockquote in a list item.

1.  There is a sentence.

> A standalone blockquote.

Some further text.
vmg commented 12 years ago

The result of @gruber's Markdown.pl for that document is invalid HTML:

<p><ol>
<li>Hello</li>
<li>World</p>

<blockquote>
  <p>A blockquote in a list item.</li>
</ol></p>
</blockquote>

Which makes sense, because as the Markdown syntax document clearly states:

To put a blockquote within a list item, the blockquote’s > delimiters need to be indented:

*   A list item with a blockquote:

    > This is a blockquote
    > inside a list item.

Consequently, this is not a bug but very sane behavior from Sundown. Cheers for reporting, though.

finsprings commented 12 years ago

Thanks.

finsprings commented 12 years ago

The confusion I see from many users of my app is that sundown requires blank lines between things that other parsers seemingly do not.

For example this works:

*   A list item with a blockquote:

    > This is a blockquote
    > inside a list item.

is rendered as:

but this:

*   A list item with a blockquote:
    > This is a blockquote
    > inside a list item.

is rendered as:

Is that a peculiarity of its implementation or is that a requirement of Markdown's syntax description?

brief commented 12 years ago

Markdown's syntax document doesn't say anything about blank lines, but plugging your example into the Markdown dingus:

*   A list item with a blockquote:
    > This is a blockquote
    > inside a list item.

results in the same invalid HTML as not indenting the delimiters:

<p><ul>
<li>A list item with a blockquote:</p>

<blockquote>
  <p>This is a blockquote
inside a list item.</li>
</ul></p>
</blockquote>