numbered list bug in markdown.pl?

Jacob Rus jrus at hcs.harvard.edu
Fri Jul 21 16:48:53 EDT 2006


John Gruber wrote:

> A. Pagaltzis <pagaltzis at gmx.de> wrote on 7/13/06 at 5:45 AM:

>> But I don't have documents any that rely on tiny indentation to

>> mark up nested lists. There is nothing in the docs that specifies

>> the behaviour of this case in detail. In fact I was surprised by

>> the actual behaviour.

>>

>> So I would argue that there is room to tweak the indentation

>> rules, but none to tweak the numbering requirements. I would

>> instead suggest that to start a nested list, the marker be

>> required to be indented at least three spaces more than the

>> preceeding item.

>

> I agree. Why three though? It "feels" like a reasonable number,

> but four spaces is the magic cut-off point in all the other places

> where indentation matters in Markdown.


Instead of basing the amount of indentation on the exact beginning of
the previous item, I would prefer that each tab or 4 spaces correspond
to one level of indentation. Thus

- 0-3 spaces = top level
- 4-7 spaces = 2nd level
- 8-11 spaces = 3rd level, etc.

Then if an item is indented more than this, it is considered a code block.

So this:

1. a list
2. 2nd item
3. third item
4. fourth item
- sublist
- in same sublist
- still on item 4
5. back to top-level

turn into this:

<ol>
<li>a list</li>
<li>2nd item</li>
<li>third item</li>
<li>fourth item
<ul>
<li>sublist</li>
<li>in same sublist</li>
<li>still on item 4</li>
</ul></li>
<li>back to top-level</li>
</ol>

instead of what we currently get:

<ol>
<li>a list
<ol>
<li>2nd item</li>
<li>third item</li>
<li>fourth item</li>
<li>sublist
<ul>
<li>in same sublist</li>
<li>still on item 4</li>
</ul></li>
<li>back to top-level</li>
</ol></li>
</ol>

Obviously this is more ragged than we hope real-life lists will be, but
by keeping stops to 4 spaces, I think we most closely stick to John's
official spec, and keep things as unambiguous as possible.

-Jacob Rus



More information about the Markdown-Discuss mailing list