Markdown generates invalid html for a list immediately followed by a quote

John Gruber gruber at fedora.net
Mon Jul 9 15:51:36 EDT 2007


Jacob Rus <jacobolus at gmail.com> wrote on 7/8/07 at 8:05 PM:


> >That's what I'm thinking the output should be. I think there should be

> >an official rule that all block-level constructs must be separated by

> >a blank line.

>

> This sounds just terrible to me. I don't want to require huge numbers of

> blank lines whenever I want deeply nested lists, etc.


Nested lists are an exception. I think conceptually, a nested
hierarchical list is, to the writer, a single thing.

My plan for lists is to simplify them as follows:

* A list is a series of list items.

* If any of the items in a list are separated by a *single*
blank line, the entire list is in paragraph mode, and the
contents of each item in the list will be wrapped in `<p>`
tags.

* Otherwise, the list is not in paragraph mode and none of the
items' contents get `<p>` tags.

* Two consecutive blank lines ends the current list, no exceptions.

So you can still do this:

--
* One
* sub-one
* sub-two
* Two
* Three
--

And the output will be the same as currently.

But if you do this:

--
* One
* sub-one with something that looks like
a paragraph

* sub-two with something that looks like
a paragraph

* Two
* Three
--

or this:

--
* One
* sub-one
* sub-two

* Two

* Three
--

then *all* of the list items will be paragraph mode.

The "double blank line to end list" rule means you'll be able to write
this:

--
* Red
* Green
* Blue


* Cyan
* Yellow
* Magenta
* Black
--

To generate two consecutive lists.

The "must precede blocks with a blank line" rule also means that any
list item that contains block-level constructs, like blockquotes or
code blocks, will put that list into paragraph mode.



> People don't always use such blank lines when they write

> (non-markdown) plain text emails or documents, and I think mandating

> them in general is a mistake.


People do all sorts of things in non-Markdown plain text that can't be
parsed in Markdown.

-J.G.


More information about the Markdown-Discuss mailing list