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

John Fraser john at attacklab.net
Mon Jul 9 18:33:20 EDT 2007


On 7/9/07, John Gruber <gruber at fedora.net> wrote:

> 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.


On 7/9/07, A. Pagaltzis <pagaltzis at gmx.de> wrote:

> But tight inner lists should never go into paragraph

> mode just because the outer list has.


With AP's modification, I like this a lot.

While we're talking about whitespace in lists, it might be worth
looking at the other axis: indentation. Right now Markdown uses
4-character tab stops to differentiate nesting levels, which can be
pretty confusing at first. It's natural to indent a nested list two
spaces, and it seems to work when you're only one level deep:

- level 1
- level 2

But things break down in weird ways when you try to go deeper with
2-character indentation:

- level 1
- level 2
- level 2
- level 3
- level 3
- level 4

I think it makes sense to get rid of this invisible 4-character grain,
and just consider a list item to be the start of a nested list if it's
indented more than the previous list item. So:

- level 1
- level 2
- level 3
- level 4
- level 5
- level 6

Another problem is that Markdown doesn't degrade gracefully when the
indentation gets wacky:

- level 1
- level 2
- level 3
- level 3
- level 3

To handle bizarre indentation, the rule should probably be that an
outdented list item belongs to the most recent list item that's
indented less. So:

- level 1
- level 2
- level 2
- level 3
- level 1

Still kind of odd, but no more odd than the input.


More information about the Markdown-Discuss mailing list