spaces and newlines before list markers (was: evolving the spec)

Seumas Mac Uilleachan seumas at idirect.ca
Mon Mar 3 09:32:07 EST 2008


Michel Fortin wrote:

> Le 2008-03-02 à 22:14, Seumas Mac Uilleachan a écrit :

>

>> What's needed is a way to distinguish your edge case from the general

>> case where it would be a list. Do you use two white spaces to

>> preserve the line breaks? Perhaps that could be the trigger in this

>> case - a line ending in two white spaces prevents the next line from

>> being formatted as a new list.

>

> I don't think that's a good idea. Two spaces at the end of a line

> means a line break, not an end of the current paragraph.

Yes, my mistake was in thinking that the lines as indented and separated
in the source was what was desired in the output, but the output removes
the leading spaces (as it should).

I have always wondered why the arbitrary starting point for numbered
lists was desirable. If Markdown is supposed to be intuitive, then it
doesn't really make sense to either start a list with a number other
than one or, if so, to then force that number to become one. The first
case is not something I have ever done myself and the second really
would be conflicting with the user's intent (imho).

Except in the case of:

* Foo
1. Blah
2. Blah
* Foo
3. Blah

or

# Header
1. Point one
2. Point two
# Header
3. Point three

(both variations on the same idea)

I can't really think of where not starting with one is desirable (and
here it's a continuation of a list that did), and this could conceivably
be covered by tracking the previous list numbers, right? Currently the
3. is changed to 1. but should it not remain 3.?

In that case, changing the syntax to say that lists start with 1. unless
there is a previous (same level) list being continued would make a lot
of sense to me. Following numbers don't have to be consecutive (for
editing and changing orders of lists etc) just ensure first item is 1.

Then again, you still have the edge case where the 1. is intended to be
the end of a sentence in the list item with another sentence following.
This is what is happening with the "2008." that started all this. It is
not the "2008." but the "from" following that creates the problem.
(remove the "from" and the 2008. is preserved as is) For that you
probably need the subtle distinction you proposed below (which works for
the above as well if you want to keep the arbitrary starting number).

>> I just tested this edge case in PHP Markdown Extra and it does the

>> same thing (both with and without the two white spaces for newlines).

>

> Indeed. I'm not sure what could be done here however, but here is an

> idea.

>

> John changed things a long time ago now so that it doesn't pose a

> problem for text at the root of the document by forcing a blank line

> to be present before a list when not inside a list. I'm thinking that

> we could do the same for the content of list item parsed as

> block-level content. For instance, here you would have a nested

> ordered list:

>

> * Blah blah blah

> 1. blah blah

> * Blah blah blah

>

> Here too:

>

> * Blah blah blah

>

> 1. blah blah

>

> * Blah blah blah

>

> But not in the next examples. Here the "1." list marker wouldn't be

> accepted because we're in a block-level list element (since there is a

> blank line between the two items):

>

>

> * Blah blah blah

> 1. blah blah

>

> * Blah blah blah

>

> Same here, because there is a blank line inside the list item:

>

> * Blah blah blah

>

> Blah blah blah

> 1. blah blah

> * Blah blah blah

>

> Perhaps that's a too subtle distinction, but it's my preferred

> solution to date.

>

>

> Michel Fortin

> michel.fortin at michelf.com

> http://michelf.com/

>

>

> _______________________________________________

> Markdown-Discuss mailing list

> Markdown-Discuss at six.pairlist.net

> http://six.pairlist.net/mailman/listinfo/markdown-discuss

>

>




More information about the Markdown-Discuss mailing list