Data loss issue: Adjacent List Types

Alan Hogan contact at
Mon Jun 6 13:20:56 EDT 2011

Esteemed human authors and robotic parse-bots:

I recently discovered that most or all Markdown implementations, including Gruber’s original in Perl, have an odd behavior with regards to lists that follow each other. Namely, a bulleted list followed by a numbered list, or vice-versa, is masked as if it were part of the first list (and of the first list’s type.)

For example, consider the following input:


- Bulleted item
- Second bulleted item

1. Numbered list
2. Second numbered item


It will yield an output of one UL element with four LI children (themselves containing some number of P tags, varying by implementation).

Now, I realize full well that a blank line between list items causes the list items to be given <p> tags. But the blank line above, to any reasonable *human*, isn’t separating list items but rather *lists.*

There is a fundamental problem in the above code: that it triggers **non-obvious data loss.**

The data is of course the numbering.

The non-obviousness is due to the way the output formatting is essentially correct, and only the list item markers are unexpected. A cursory scan of the Markdown-transformed text — e.g., looking over a blog post before publishing — will show no structural problems. Success, publish! … How long until the author realizes his/her reference to “step #2” is actually referring to the fourth bullet in an awkward list?

One of the nicest things about Markdown is that once you get it, and it doesn’t take long, then there is precious little by way of surprises it will throw at you.

If for no other reason, I think the counter-intuitiveness and “crap do I really have to remember that you can’t follow a list by a list” moment are in and of themselves reasons to change the behavior. Besides the data loss.

I also struggle to imagine anyone who would be upset at the change. After all, what end-user would *rely* on this feature to munge their list types?


More information about the Markdown-Discuss mailing list