42

It's easy to create a numbered list in Markdown:

  1. Item 1
  2. Item 2
  3. Item 3

However, if I forgot something before "Item 1", I tried adding a "0th" item:

  1. Item 0
  2. Item 1
  3. Item 2
  4. Item 3

Look at the Markdown, I actually used 0-3 instead of 1-4:

0. Item 0
1. Item 1
2. Item 2
3. Item 3

Interestingly enough, this works even if blockquoted. I had to use code formatting to get it to show as written.

Now, you could easily argue this is a feature (look, it fixed it for me!) unless I actually wanted some different numbering scheme.

Is there/should there be a way to override this behavior? It seems like a "bug as a feature" at the moment.

NOTE I changed this to since this is from a bug point of view: https://meta.stackoverflow.com/a/271736/445425 (thanks @chrisneilsen).

6
  • 30
    Especially on a programming-site, lists should be allowed to begin with 0... Commented Jan 23, 2015 at 21:56
  • 3
    @Deduplicator Maybe the guy that set this up was a VB fanatic :( Commented Jan 23, 2015 at 22:04
  • 19
    Let's point out this only happens if you start the list with 0. Starting with any other number above 0 will start the numbered list with that first number and count up from there (so 5, 6, 7, 8 and 5, 3, 8, 2 would both produce the numbered list 5, 6, 7, 8).
    – animuson StaffMod
    Commented Jan 23, 2015 at 22:13
  • 2
    @animuson Thanks for pointing that out. Of course, its still overriding your numbering, just in a potentially less annoying way. Commented Jan 23, 2015 at 22:14
  • Seems that this is by design Commented Jan 23, 2015 at 23:01
  • 2
    It can be nice to be able to just go 1. ... 1. ... 1. ... without having to think about the numbering when writing a mostly-unplanned list. Commented Jan 25, 2015 at 20:58

1 Answer 1

41

Defeated! (Well, somewhat. See EDIT 2 below.)

  1. First
  2. Second

Markdown:

<ol start="0">
<li>First</li>
<li>Second</li>
</ol>

Sure, you probably aren't going to take the time to do this, but as long as browsers support the start attribute you have the option.

EDIT - There's some potential minor abuse possible with this (or a CSS issue):

  1. First
  2. Second

For me, the numbers flow way outside the margins of the answer div.

EDIT 2 - You apparently lose other formatting abilities by using the HTML structure:

  1. `I can't code` or **bold** or *italicize*, but
  2. I can key or strikethrough (and other HTML formatting features like <code>abc</code> <b>bold</b> <i>italicize</i>)
3
  • 7
    While having to go as far as custom HTML to defeat this seems a bit much, this is a clean workaround. Thanks! Commented Jan 23, 2015 at 22:21
  • If it makes you feel better, markdown has the same problem for large start numbers. Commented Jan 23, 2015 at 22:59
  • 13
    At your Edit 2: That is correct. Because the Markdown parser removes the entire <ol></ol> block as a "pure HTML" block and assumes it's an already-completed piece of the output, thus doesn't attempt to parse it further. Whenever you surround something in HTML tags, you do have to apply all other formatting inside those tags via HTML as well. You can't mix them together.
    – animuson StaffMod
    Commented Jan 24, 2015 at 0:52

You must log in to answer this question.

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