Markdown Ordered Lists to HTML ol/li Tags
Convert Markdown numbered lists (1., 2., 3.) to HTML <ol> and <li> tags. Learn about automatic numbering, start attribute, and list continuation.
Detailed Explanation
Ordered Lists in Markdown
Markdown ordered lists use numbers followed by a period and a space. They convert to HTML <ol> and <li> elements.
Basic Ordered List
1. First item
2. Second item
3. Third item
Converts to:
<ol>
<li>First item</li>
<li>Second item</li>
<li>Third item</li>
</ol>
Automatic Numbering
In standard Markdown, the actual numbers you use do not matter — the parser auto-numbers sequentially. This means the following also produces a correctly numbered list:
1. First item
1. Second item
1. Third item
This produces the same <ol> with items numbered 1, 2, 3 in the browser. Some authors prefer this style because it makes reordering items easier — you never need to renumber.
Starting at a Different Number
Some Markdown parsers (including CommonMark) honor the first item's number using the start attribute:
3. Third item
4. Fourth item
5. Fifth item
Converts to:
<ol start="3">
<li>Third item</li>
<li>Fourth item</li>
<li>Fifth item</li>
</ol>
Multi-Paragraph List Items
Like unordered lists, indent continuation content with four spaces:
1. First item
Additional paragraph under first item.
2. Second item
Mixing Ordered and Unordered
You can nest unordered lists inside ordered lists and vice versa — see the nested lists example for details.
Use Case
Ordered lists are essential for step-by-step instructions, installation guides, tutorials, and ranked lists. The start attribute is particularly useful when continuing a numbered sequence that was interrupted by other content.