[kramdown-users] Bug in list parsing

Thomas Leitner t_leitner at gmx.at
Thu Aug 19 13:53:05 EDT 2010


> I continue to advocate the use of white-space lines to separate
> blocks.  Contiguous lines of text, regardless of indentation, belong
> to the same block.  Thus:
> 
>     > ... but this is wrong!
>     No, it is not!
> 
> is a single blockquote, while

The problem with the above example is that it can be interpreted in
both ways and we have to decide what's the better one.

> 
>     > ... but this is wrong!
> 
>     No, it is not!
> 
> results in one blockquote and one paragraph.

This works in Markdown and in kramdown. If you separate your block
level elements by blank lines you will always get the correct result.
However, blank lines between *all* block level elements is not enforced
- see the syntax documentation where blank lines are needed.
 
> A list block following a list block at the same indentation is
> converted to a single list block with paragraph list items:
> 
>     1. One
>     2. Two
> 
>     3. Three
> 
>     <ol>
>        <li><p>One</p></li>
>        <li><p>Two</p></li>
>        <li><p>Three</p></li>
>     </ol>

This is already done, however, conversion of simple list texts to
paragraphs follows other rules. In the above case, only the second item
would be wrapped in a paragraph.

> Tables and math blocks have their own internal syntax, but tables
> must be bordered by white-space lines and/or file boundaries:
> 
>     Here is a paragraph
>     | with | table code | too close |
> 
>     <p>Here is a paragraph | with | table code | too close |</p>

This is not enforced in kramdown, ie. you can follow a paragraph
directly with a table.
 
> If you read the text/plain part of this email, you'll likely see that
> the preceding text has been wrapped.  kramdown should still be able
> to recognize it as a list.  This is a core feature of Markdown, and
> it needs to be supported for kramdown to be acceptable by mainstream
> end users, who do not have patience to indent lines as precisely as
> you have advocated.  Markdown was created for its simplicity, to be
> usable by regular people, and support for lazy-indentation is a key
> part of that simplicity.  If kramdown does not support such a key
> feature of Markdown, then it really can't be called a superset of
> Markdown anymore.

Yes, I *see* that the text is wrapped by my email program. However,
when I copy and paste the text, each paragraph is still copied as
one long line and therefore there are no problems with kramdown
processing the content. So if you just *write* long lines, everything
is fine with kramdown. However, if you *hard-wrap* lines yourself, then
you are in trouble.


Aside from the specific discussion about list syntax we can talk about
whether it would be useful to enforce the use of blank lines for some
more block level elements. For example, headers have to be preceded by a
blank line already. We could discuss if it would be useful to do
something similar with other block elements like math block and
tables... 

-- Thomas


More information about the kramdown-users mailing list