[kramdown-users] Bug in list parsing

Shawn Van Ittersum svicalifornia at gmail.com
Mon Aug 16 13:42:25 EDT 2010


There's a problem with kramdown's recognition of list items with "wrapped" or "lazy" indentation, whereby kramdown's output does not match Markdown's.

Gruber's Markdown syntax guide:

To make lists look nice, you can wrap items with hanging indents:

*   Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
    Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi,
    viverra nec, fringilla in, laoreet vitae, risus.
*   Donec sit amet nisl. Aliquam semper ipsum sit amet velit.
    Suspendisse id sem consectetuer libero luctus adipiscing.

But if you want to be lazy, you don’t have to:

*   Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi,
viverra nec, fringilla in, laoreet vitae, risus.
*   Donec sit amet nisl. Aliquam semper ipsum sit amet velit.
Suspendisse id sem consectetuer libero luctus adipiscing.

Taking the last block above as input, Markdown outputs a nice unordered list:

<ul>
<li>Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi,
viverra nec, fringilla in, laoreet vitae, risus.</li>
<li>Donec sit amet nisl. Aliquam semper ipsum sit amet velit.
Suspendisse id sem consectetuer libero luctus adipiscing.</li>
</ul>

However, kramdown doesn't recognize anything beyond the first line as an unordered list, and instead wraps the remainder in paragraph tags.  It outputs:

<ul>
  <li>Lorem ipsum dolor sit amet, consectetuer adipiscing elit.</li>
</ul>
<p>Aliquam hendrerit mi posuere lectus. Vestibulum enim wisi,
viverra nec, fringilla in, laoreet vitae, risus.
*   Donec sit amet nisl. Aliquam semper ipsum sit amet velit.
Suspendisse id sem consectetuer libero luctus adipiscing.</p>

I'm working with Markdown-syntax text in email messages, which get wrapped by mail transports beyond user control.  As Gruber says in the Philosophy of Markdown, "the single biggest source of inspiration for Markdown’s syntax is the format of plain text email."  So it would be great if kramdown would handle this "wrapped" indentation of lists as gracefully as Markdown does.

Please let me know if this is something you can fix, and when I can test it again. :)

Thanks,
Shawn


More information about the kramdown-users mailing list