Syntax Reference
Markdown Lists
Markdown has 3 list types: unordered lists (-, *, +) convert to <ul>, ordered lists (1.) convert to <ol>, and indenting nests one list inside another. Task lists are a GitHub Flavored Markdown extension.
Key facts
- List types
- 3: unordered, ordered, nested
- Unordered markers
- -, *, or + (all become <ul>)
- Output elements
- <ul>, <ol>, and <li>
- Task lists
- GitHub Flavored Markdown extension
How do Markdown lists convert to HTML?
Markdown lists convert to HTML <ul> and <ol> elements. Unordered lists become <ul>, ordered lists become <ol>, and every list item becomes an <li>. Indenting a sub-list nests it inside the parent <li>.
Markdown defines 3 list types: unordered, ordered, and nested. Each maps to semantic list markup a browser styles with bullets or numbers. Convert a full list with the Markdown List to HTML, or browse every element in the Markdown Syntax Guide.
- Apple
- Pear
- Plum<ul>
<li>Apple</li>
<li>Pear</li>
<li>Plum</li>
</ul>How do you write an unordered list in Markdown?
Start each line with a hyphen (-), asterisk (*), or plus (+) followed by a space. All 3 markers convert to the same HTML <ul> with one <li> per item. The marker choice does not change the output.
Use one marker consistently within a single list. A blank line must separate the list from surrounding paragraphs so the parser recognises it as a list block.
* Coffee
* Tea
* Juice<ul>
<li>Coffee</li>
<li>Tea</li>
<li>Juice</li>
</ul>How do you write an ordered list in Markdown?
Start each line with a number, a period, and a space, such as 1. Item. The list converts to an HTML <ol> with one <li> per item. Browsers render the sequence, so the literal numbers need not be consecutive.
Numbering from a value other than 1 adds a start attribute: 3. emits <ol start="3">. Because the browser counts the items, writing 1. on every line still renders 1, 2, 3.
1. First
2. Second
3. Third<ol>
<li>First</li>
<li>Second</li>
<li>Third</li>
</ol>How do you nest a list in Markdown?
Indent the child items by 2 spaces under a parent item. The indented list converts to a nested <ul> or <ol> placed inside the parent <li>, producing a hierarchy. Ordered and unordered lists nest interchangeably.
Consistent indentation marks each nesting level. A child <ul> or <ol> renders inside its parent <li>, so the structure mirrors the indentation in the source.
- Fruit
- Apple
- Pear
- Veg<ul>
<li>Fruit
<ul>
<li>Apple</li>
<li>Pear</li>
</ul>
</li>
<li>Veg</li>
</ul>How do task lists differ from ordered and unordered lists?
Task lists are a GitHub Flavored Markdown extension, not standard Markdown. The syntax - [x] converts to a checked checkbox and - [ ] to an unchecked one, each wrapped in an <li> inside a <ul>.
Standard Markdown defines only ordered and unordered lists; checkboxes require GFM to be enabled. See Markdown Task Lists for the full task-list rules, or convert every GFM feature with GitHub Flavored Markdown to HTML.
- [x] Done
- [ ] Todo<ul>
<li><input type="checkbox" checked disabled> Done</li>
<li><input type="checkbox" disabled> Todo</li>
</ul>Which Markdown list types convert to HTML list elements?
All 3 Markdown list types convert to HTML: unordered lists to <ul>, ordered lists to <ol>, and nested lists to a <ul> or <ol> inside a parent <li>. GFM task lists add checkbox inputs to <ul> items.
These list types combine freely: nest an ordered list inside an unordered one, or vice versa, and each level renders the correct element. Convert any combination at once with the Markdown List to HTML.
Frequently Asked Questions
- What HTML element does a Markdown unordered list produce?
- An unordered list produces a <ul> element with one <li> per item. The -, *, and + markers all convert to the same <ul>, so the marker you choose does not change the HTML output.
- Do the numbers in a Markdown ordered list have to be sequential?
- No. The browser renders the sequence from the <ol>, so writing 1. on every line still displays 1, 2, 3. The first number sets the start value: beginning at 3. emits <ol start="3">.
- How much do I indent to nest a Markdown list?
- Indent child items by 2 spaces under their parent item. The indented sub-list converts to a nested <ul> or <ol> inside the parent <li>. Keep indentation consistent so each nesting level is recognised.
- Are task lists part of standard Markdown?
- No. Task lists are a GitHub Flavored Markdown extension. The - [x] and - [ ] syntax converts to checkbox inputs only when GFM is enabled; standard Markdown defines just ordered and unordered lists.