numbered list bug in markdown.pl?

Michel Fortin michel.fortin at michelf.com
Wed Jul 12 21:46:41 EDT 2006


Le 12 juil. 2006 à 20:33, Jacob Rus a écrit :


> Yes, I realize it's picking things up as multiple indentation

> levels, but I offer that this is a bug, and that python markdown

> has this right. Having numbers of numbered lists right-aligned

> seems like a legitimate method of writing them in plain text, and

> when there is *less* indentation, having a sublist formed is

> counter-intuitive to me. I would prefer to have it keep them as

> part of the same list, but would possibly understand if it ended

> the current list and started a new one. Making less-indented

> numbers into a sublist just seeems weird, especially since using

> 0-3 spaces to start the first list item is allowed by spec.


I consider that as a bug too. But it seems to be due to an
undocummented, but wildly used, feature of Markdown. This may make it
hard to solve while still preserving backward compatibility.

Currently, something like this produce a nested list inside the first
list item:

1. List item
1. Sublist item
2. List item

The problem Jacob have occurs when you right-align list markers which
are not always the same lenght. As a general case, something like
this is expected to produce one list, but currently produce two
nested list:

1. List item
10. List item
20. List item
2. List item

Any solution to this problem must absolutly preserve left-aligned
markers too. This should be equivalent to the previous example:

1. List item
10. List item
20. List item
2. List item

And this too:

1. List item
10. List item
20. List item
2. List item

The problem is that in these three cases, the alignment is different;
there is no single reference to take into account (the number, the
dot, or the text). If we want to preserve backward compatibility, we
would need to support sublists just as they exists currently too. For
example would yeild two sublists:

1. List item
10. Sublist item
20. List item
2. Sublist item

But how is the second sublist item different from the first 1-10-20-2
example of this post:

1. List item
10. List item
20. List item
2. List item

?

It is clear now that to solve that problem, we have to break
something else. That something could be the currently undocumented
way nested lists are created by less than four space, or it could be
a requirement for ordered markers. Either way there is a risk of
breaking something.

Personally, I'd go the route of requiring an increasing character
count for numeric markers when they are right-aligned because I think
it is the less damaging thing to do to current Markdown text and
because it makes sense visually. The previous example would be
equivalent to this:

1. List item
10. List item
20. List item
2. List item

As would this:

1. List item
2. List item
3. List item
4. List item

Not perfect, as it still breaks the rule saying you can use any
number as list marker when numbers are more than one character and
right-aligned, but it is the best compromise I can think of. What do
you think?


Michel Fortin
michel.fortin at michelf.com
http://www.michelf.com/




More information about the Markdown-Discuss mailing list