Leon Mika

Leon Mika

On Ordered Lists in Markdown

One of the things I like about Markdown as a form of writing online, is that ordered lists can simply begin with the prefix 1., and there is no need to update the leading number in the subsequent items. To produce the following list:

  1. First
  2. Second
  3. Third

One only needs to write:

1. First
1. Second
1. Third

or:

1. First
2. Second
3. Third

or even:

1. First
3. Second
2. Third

The one downside to this approach, unfortunately, is that there is no nice way to specify what the first ordinal should be. If I were to use 3. as the prefix of the first item, the generated ordered list will always begin at 1.

This means that there’s no nice way to continue lists that are separated by block elements. For example, let’s say I want to have a list of 4 items, then a paragraph of text or some other block element, then continue the list from 5. The only way to do so in “common-style” Markdown is to write the second list in HTML with an <od start=5> tag:

<ol start=5>
  <li>Fifth</li>
  <li>Sixth</li>
  <li>Seventh</li>  
</ol>

It would be nice if this was representable within Markdown itself. Maybe by taking into account the first ordinal and just incrementing by 1 from there. For example:

5. Fifth
5. Sixth
5. Seventh

becomes

  1. Fifth
  2. Sixth
  3. Seventh

So what?, you might say. You just demonstrated that this could be done in HTML.

That’s true, however I use wiki software with rich-text editors that don’t allow modifying the underlying HTML (they may have the ability to specify a “region” of HTML, but not a way to modify the underlying body text itself) and they use Markdown as a way of triggering formatting changes. For example, typing * twice will enable bold face, typing three ` will start a code block… and typing 1. will start an ordered list.

Changing the first ordinal or continuing the previous list might be considered an advanced operation that the developers of these wikis may not have considered. But I can’t help wonder if Markdown had this feature from the start, all these editors would have supported it in one form or another.