Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Begin ordered list from 0 in Markdown

I'm new to Markdown. I was writing something like:

# Table of Contents   0. Item 0   1. Item 1   2. Item 2 

But that generates a list that starts with 1, effectively rendering something like:

# Table of Contents 1. Item 0 2. Item 1 3. Item 2 

I want to start the list from zero. Is there an easy way to do that?

If not, I could simply rename all of my indices, but this is annoying when there are several items. Beginning a list from zero seems so natural to me, it's like beginning the index of an array from zero.

like image 895
thiagowfx Avatar asked Feb 25 '13 23:02

thiagowfx


People also ask

Does ordered list Start 0?

An ordered list starts with the <ol> tag. Each list item starts with the <li> tag.

How do I add an ordered list in MarkDown?

To create an ordered list, add line items with numbers followed by periods. The numbers don't have to be in numerical order, but the list should start with the number one.

Can you start an ordered list with a specific number?

The start attribute specifies the start value of the first list item in an ordered list. This value is always an integer, even when the numbering type is letters or romans. E.g., to start counting list items from the letter "c" or the roman number "iii", use start="3".

How do you create a an ordered list?

In HTML, we can create an ordered list using the <ol> tag. The ol in the tag stands for an ordered list. Inside each of the ordered list elements <ol> and <ol /> , we have to define the list items. We can define the list items using the <li> tag.


2 Answers

Simply: NO

Longer: YES, BUT

When you create ordered list in Markdown it is parsed to HTML ordered list, i.e.:

# Table of Contents  0. Item 0   1. Item 1   2. Item 2 

Will create:

<h1>Table of Contents</h1> <ol>   <li>Item 0</li>   <li>Item 1</li>   <li>Item 2</li> </ol> 

So as you can see, there is no data about starting number. If you want to start at certain number, unfortunately, you have to use pure HTML and write:

<ol start="0">   <li>Item 0</li>   <li>Item 1</li>   <li>Item 2</li> </ol> 
like image 197
Hauleth Avatar answered Sep 21 '22 18:09

Hauleth


You can use HTML start tag:

<ol start="0">   <li> item 1</li>   <li> item 2</li>   <li> item 3</li> </ol> 

It's currently supported in all browsers: Internet Explorer 5.5+, Firefox 1+, Safari 1.3+, Opera 9.2+, Chrome 2+

Optionally you can use type tab for more sophisticated enumerating:

  • type="1" - decimal (default style)
  • type="a" - lower-alpha
  • type="A" - upper-alpha
  • type="i" - lower-roman
  • type="I" - upper-roman
like image 33
masterspambot Avatar answered Sep 20 '22 18:09

masterspambot