83

Why can't I start a numbered list on an arbitrary number?

Example:

  1. Some Point
    • sub point
    • sub point

some explanation pertaining to point 1 above

  1. this should be a 2. not a 1. as I wrote 2. but it changes automatically to 1.

Escaping the dot (2\.) works but as you can see

2. it moves the list too far to the left.

Can we get lists that start on any number?

3
  • 12
    Because Markdown sucks when it comes to lists.
    – user1228
    Commented Jun 21, 2012 at 15:55
  • 3
    Does this answer your question? Bug in editor for numbered lists?
    – Rob
    Commented Nov 29, 2021 at 13:26
  • 2
    I'm closing it in the other direction; this one is newer but it does have an authoritative answer.
    – Glorfindel Mod
    Commented Nov 29, 2021 at 14:07

5 Answers 5

75

Given that

  1. the vast majority of people want this feature,
  2. CommonMark, which we eventually hope to use, supports it, so it would come eventually anyway,
  3. the impact should be minimal since most Markdown lists start with 1.,
  4. even where this isn't the case, nothing will change until the post is edited (we don't automatically re-render questions and answers),

… look, a squirrel!

  1. the start attribute on ol elements has been de-deprecated, so we don't have to mess around with CSS,
  2. and this change was fairly easy to implement in the current Markdown version,

you can now start with numbers other than 1. As I said in my other answer,

The number that starts a numbered list in the Markdown source will also be the starting number in the rendered version. The actual values of subsequent numbers will be irrelevant as always (the rendered version will just increment one-by-one); only the first number counts.

This change is live on all sites.

8
  • FYI, TR/html-markup is obsolete as of 2013, but they stupidly only placed the notice on the front page of that specification. While the start attribute has indeed been reinstated, some other information within that specification may be out of date. Commented Sep 9, 2014 at 9:58
  • 1
    Also, is this in Sta— ahem, Common Markdown? Commented Sep 9, 2014 at 10:01
  • @BoltClock'saUnicorn See point 2.
    – balpha StaffMod
    Commented Sep 9, 2014 at 10:14
  • 26
    YOU ARE DISCRIMINATING AGAINST MY RIGHT FOR 0-INDEXED LISTS. HELP HELP I AM BEING REPRESSED!!
    – badp
    Commented Sep 9, 2014 at 14:31
  • @badp #notalllists
    – balpha StaffMod
    Commented Sep 9, 2014 at 16:16
  • 1
    In just under the wire at 30 min to midnight local time this is the best news I've heard all day (and I say that having seen it first on Twitter which is teaming with product release "news" today).
    – Caleb
    Commented Sep 9, 2014 at 20:26
  • And a 1, and a 2, and 1, 2, 3: “♫ ⅰ little, ⅱ little, ⅲ little Indians, ⅳ little, ⅴ little, ⅵ little Indians, ⅶ little, ⅷ little, ⅸ little Indians, ⅹ little Indian boys! ♫”
    – tchrist
    Commented Sep 20, 2014 at 0:17
  • Numbering lists starting from 0 does, actually, work, the joke above notwithstanding. Commented Jan 20, 2021 at 7:57
54

Traditionally, these requests have been closed as dupes of Numbering/bullet interpretation bug?, but I'll keep this open since I think it's worth reconsidering. Even John Gruber's original Markdown documentation says

If you do use lazy list numbering, however, you should still start the list with the number 1. At some point in the future, Markdown may support starting ordered lists at an arbitrary number.

In other words, it wouldn't be a total deviation from the standard, even if the above was never added to the originial implementation.

However, it's still a breaking change to the syntax, so I would like to use this question to have some discussion on this. The change would be as follows:

The number that starts a numbered list in the Markdown source will also be the starting number in the rendered version. The actual values of subsequent numbers will be irrelevant as always (the rendered version will just increment one-by-one); only the first number counts.

Example:

5. five
8. eight
2. two

becomes

5. five
6. eight
7. two

So please chime in if you see any issues with this change. It has my vote, but there a lots of people here who use Markdown, so I may be forgetting possible issues.

12
  • 17
    This would be fantastic
    – darryn.ten
    Commented Jun 21, 2012 at 10:22
  • 2
    I think the one in the question is a good reason not to implement this change. The fact Matt's proposal looks wrong is because of a problem with the styles, not in the parsing of Markdown.
    – badp
    Commented Jun 21, 2012 at 10:34
  • That makes perfect sense to me. I'd be quite surprised if this ended up breaking a post, but as you said you never know :)
    – user50049
    Commented Jun 21, 2012 at 10:37
  • 2
    Should be relatively easy to check the existing posts for patterns that would break, shouldn't it? I've been missing that feature for long and would be very happy to see it implemented.
    – Tomalak
    Commented Jun 21, 2012 at 10:48
  • 2
    If it breaks stuff why not use a comment-based extension like done for the syntax highlighter: <!-- list-start: 5 -->
    – ThiefMaster Mod
    Commented Jun 21, 2012 at 11:17
  • 5
    @ThiefMaster HTML comments for this kind of thing (even for syntax highlighting) are an ugly, undiscoverable hack. But unlike for syntax highlighting, the list start thing actually has an obvious solution, as evidenced by the fact that even the original Markdown doc considers (if not implements) it.
    – balpha StaffMod
    Commented Jun 21, 2012 at 11:50
  • I’d say that it depends how this is implemented in HTML. Via CSS counters? Good. But does that work everywhere? What are the alternatives? Commented Jun 21, 2012 at 12:33
  • One case I haven't been able to figure out is having an ordered list of code blocks. To get the code to format properly, you have to break the list or MD will assume it's another paragraph. But then you can't actually number it...
    – Felipe
    Commented Apr 22, 2013 at 23:58
  • So how do we chime in to support this change? Upvote darryn.ten's comment? Resuming interrupted lists has its uses. I'd also like to start lists at 0 in programming contexts sometimes. (@Felipe This has nothing to do with numbering… A list is a level of nesting, so you need to nest the code block one level further: indent with 8 spaces instead of 4.) Commented Jul 10, 2014 at 8:21
  • 3
    This is still needed, the given solution is still ideal, and it still ought to be an easy fix. Please?
    – Ry-
    Commented Jul 12, 2014 at 20:03
  • This proposal would provide a solution for the situation I describe in my comment on the original question.
    – Mars
    Commented Aug 17, 2014 at 5:12
  • Any news on this?
    – Stijn
    Commented Aug 19, 2014 at 12:55
28

EDIT: When I wrote this post (June 2012), it was not possible to start a numbered list from something other-than 1. However, you can as of September 2014. See here.

This is a feature of Markdown as far as I know, it's lets you do:

  1. Let
  2. Me
  3. Do
  4. That for you

via:

 5. Let
 4. Me
 3. Do
 2. That for you

(Real case situation: don't you hate it when you have 20 items, and then want to add another one between 2 and 3, and have the rename the whole lot?)

I guess SE could allow the start attribute in the <ol> element to let you do this, but all in all, is there a real life scenario you can provide where you need to do this?


In your provided scenario, what you should really be doing is;

1. Some Point
    - sub point
    - sub point

 Some explaination pertaining to point 1 above

2. this should be a 2. not a 1. as I wrote 2. but it changes automatically to 1.

Note the space before "Some", which provides;

  1. Some Point

    • sub point
    • sub point

    some explaination pertaining to point 1 above

  2. this should be a 2. not a 1. as I wrote 2. but it changes automatically to 1.

6
  • 2
    This is still too difficult to read and doesn't align nicely. I have gone with putting 3x nbsp;s before the number the list should start on and escaping the period.
    – darryn.ten
    Commented Jun 21, 2012 at 9:43
  • 7
    Re: “…but all in all, is there a real life scenario you can provide where you need to do this?” Well, I can: in this question, the quoted text should show list number 6 instead of 1; resulting in the fact that the quote is actually incorrect after markdown formats it. There is no way to work around the problem unless you want to ruin the list-style formatting. That certainly fits a RealLife™ scenario showing why this is indeed a frequently met problem.
    – e-sushi
    Commented Nov 30, 2013 at 18:39
  • Suppose I want to insert a paragraph between two items? If this paragraph is part of the first item, then it should be indented. Some solutions allow this. However, if the paragraph is a comment about several items preceding it, or an aside about some broader issue related to the list, then it shouldn't be indented, and the item following the paragraph should have the next number after the item that preceded it. What OP is requesting would provide a way to implement that by setting the number of the item after the unindented paragraph.
    – Mars
    Commented Aug 17, 2014 at 5:10
  • No, one shouldn't necessarily be doing what Matt suggests. It depends. As I note in my comment on the original question: What if the "some explanation" pertains to several points above, or provides an explanation that introduces the following points, etc.
    – Mars
    Commented Aug 17, 2014 at 5:13
  • 1
    Meanwhile, this has changed. See balpha's latest answer.
    – Arjan
    Commented Nov 9, 2014 at 15:22
  • @Matt, e-sushi. Here's another example: english.stackexchange.com/a/380203/8278 . The start is required because there's no other way to insert bullet points between numeral points.
    – Pacerier
    Commented May 7, 2017 at 9:37
3

To make lists "pretty", add double line breaks between items. This surrounds every list items with a <p>, making all vertical spacing consistent.

1. Some Point

    - sub point

    - sub point

 some explaination pertaining to point 1 above

2. this should be a 2. not a 1. as I wrote 2. but it changes automatically to 1.

renders as:

  1. Some Point

    • sub point

    • sub point

    some explaination pertaining to point 1 above

  2. this should be a 2. not a 1. as I wrote 2. but it changes automatically to 1.

3
  • I do not see how this answers OP's question… “Can we get lists that start on any number?”
    – e-sushi
    Commented Nov 30, 2013 at 18:44
  • @e-sushi: My answer is a response to this comment by the OP. I just couldn't fit it into the comment area...
    – Dennis
    Commented Nov 30, 2013 at 19:50
  • Oh, I didn't notice that. Makes sense… thanks for the heads-up! (btw: have a nice weekend.)
    – e-sushi
    Commented Nov 30, 2013 at 20:01
1

FWIW, you can create an individually numbered list by beginning new lines with non-breaking spaces. So if you want to have this list:

 3.
 5.  
 7.   

Just type in:

`&nbsp;3.`
`&nbsp;5.`  
`&nbsp;7.`

To align with other lists, just use three &nbsp;. Also, end each line with double-spaces.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .