27

I was just editing this question, when I noticed that the enumeration markup has what appears to be a bug.

Using this markup in the editor:

0. line 1 
0. line 2

The final output looks like this:

  1. line 1
  2. line 2

(Notice that the numbering starts with 0 when viewing the final output)

However, the preview while editing shows

1. line 1
2. line 2

In the post I was trying to edit, as well as this post, the final output starts at 0, while the editor preview starts at 1.

This has changed from previous functionality as it used to be 1 based.

9
  • This should probably be migrated to Meta Stack Exchange as it is generic to the entire network...
    – Werner
    Commented Sep 18, 2014 at 17:27
  • @Werner, you may be right, I dont think cross-posting is a good idea however, perhaps it should be migrated by a mod.
    – crthompson
    Commented Sep 18, 2014 at 19:33
  • 2
    I was confused by what you meant at first, so I edited your post to make it more explicit about what was wrong. Hopefully I didn't mess up any details.
    – gunr2171
    Commented Sep 18, 2014 at 19:42
  • There may be minor discrepancies between the preview and the final version of the post.
    – gparyani
    Commented Sep 18, 2014 at 21:30
  • @damryfbfnetsi ok, not sure why, but even if you are correct, this used to work the same. Its a change in the behavior.
    – crthompson
    Commented Sep 18, 2014 at 22:17
  • FYI: This behavior seems to be consistent with the CommonMark spec, but not the CommonMark reference implementation.
    – Ajedi32
    Commented Sep 19, 2014 at 14:49
  • @Ajedi32 that is a great find. FTA: The start number of an ordered list is determined by the list number of its initial list item. The numbers of subsequent list items are disregarded. And sure enough, if I use 1. line1 it works. It would be nice to see some consistency however.
    – crthompson
    Commented Sep 19, 2014 at 17:02
  • For anyone wanting to see this in action, clicking 'edit' on this post demonstrates the problem.
    – blahdiblah
    Commented Sep 19, 2014 at 17:36
  • 1
    I have reproduced the issue and am taking a look.
    – Haney StaffMod
    Commented Sep 19, 2014 at 17:56

1 Answer 1

7

Thanks for reporting this. I have fixed a JavaScript bug in our Markdown converter code that would treat ordered lists that start with 0 as if they started with 1 for preview purposes. This will be live in the next build (newer than meta: rev 2014.9.19.2585, q&a: rev 2014.9.19.1875).

IMPORTANT EDIT:

It turns out that I lied. After speaking with my colleagues, we have concluded that lists which begin with 0 are an invalid case. I will be pushing out a fix that instead shows both the preview and post list as starting at 1 instead of 0. In other words, I'm going to do the opposite fix (make the post match the preview instead of the preview match the post).

4
  • 1
    Any chance to share some of the reasons? Starting at 0 might be important for some quotes... Commented Sep 19, 2014 at 20:12
  • 2
    I definitely agree with you. However my peers felt strongly about it and the Markdown spec (and CommonMark spec) don't actually indicate what numbers are valid for lists. I'd say make it a meta post and see if it gets traction?
    – Haney StaffMod
    Commented Sep 19, 2014 at 20:14
  • 2
    @Haney I inadvertently made that Meta post (and would like this to change): meta.stackoverflow.com/questions/284387/… Commented Jan 23, 2015 at 23:04
  • Me, too. In this answer, I really wanted the first item to be numbered 0, because it is really a note rather than one of the two proposed solutions. (I accept that not everyone will approve of this style, but it's my answer :) ) The workaround suggested in Cory's answer to @BradleyDotNET's question is not satisfactory because both list items include code blocks, massively increasing the amount of HTML which I would have needed to include.
    – rici
    Commented Mar 5, 2018 at 21:18

You must log in to answer this question.

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