Markdown lists
Start a line with -, * or + and a space for a bullet list, or with a number, a period and a space for a numbered list. Indent a line under an item to nest it. These rules come from CommonMark, so lists behave the same in GitHub, VS Code and most Markdown editors.
- Milk
- Eggs
- Free range
- Bread
1. Preheat the oven
2. Mix the batter
3. Bake for 25 minutes
Which bullet character should you use?
Any of -, * or + works. Pick one and keep it, because in CommonMark changing the bullet character starts a new list, so mixing - and * produces two separate lists. Numbered lists work the same way: switching between 1. and 1) starts a new list.
The space after the marker is required. -item and 1.item are plain text.
How do numbered lists count?
The renderer uses the first number and counts up from there. The numbers you type on later lines are ignored, so writing 1. on every line still renders 1, 2, 3 and lets you reorder items without renumbering.
To start at another number, begin with it:
5. Check the logs
6. Restart the service
That list renders starting at 5. CommonMark allows start numbers of up to nine digits.
Two related rules from the spec:
- Inside a paragraph, only a line starting with
1.can begin a numbered list without a blank line before it. A wrapped line that happens to start with14.stays part of the paragraph. - A paragraph that begins with a number and a period, such as
1986. A great year, becomes a list item. Write1986\. A great yearto keep it as text.
How do you nest lists?
Indent the child item so its marker lines up with the text of the parent item, not with the parent's marker. Under - that is two spaces; under 1. it is three. An indent of four spaces also works for both in CommonMark and is what many older converters expect.
1. Plan
- Draft goals
- Review budget
2. Build
1. Prototype
2. Test
With too little indentation, the child becomes a sibling item or starts a separate list instead of nesting. With four or more spaces past the parent's text, it is no longer read as a list item: it joins the parent's text or, after a blank line, becomes an indented code block.
How do you put paragraphs or code inside a list item?
Indent the extra block to the same column as the item's text and leave a blank line before it. The block then belongs to the item instead of ending the list.
1. Install the package.
Run this in a terminal:
```bash
npm install
```
2. Start the app.
What is the difference between loose and tight lists?
A list is tight when its items sit on consecutive lines, and loose when any two items are separated by a blank line or an item holds two blocks with a blank line between them. CommonMark wraps each item of a loose list in a paragraph, so most renderers add space between the items.
One blank line anywhere makes the whole list loose, which is why a list can suddenly spread out after a small edit.
How do you keep two lists apart?
Two lists with the same marker and a blank line between them merge into one loose list. To keep them separate, change the bullet character, put a paragraph between them, or add an HTML comment <!-- --> on its own line, which the CommonMark spec suggests for this case.
Lists in Noteline
Noteline renders bullets and numbers as you type. Enter continues the list with the next marker or number, Enter on an empty item ends the list, and Tab and Shift+Tab indent and outdent an item. Cmd+Shift+8 starts a bullet list and Cmd+Shift+7 a numbered list on a Mac (Ctrl+Shift+8 and Ctrl+Shift+7 on Windows and Linux). Nested numbered lists display as numbers, letters and roman numerals by depth, while the file keeps plain numbers that any Markdown app can read.
Common questions
Why does my numbered list restart at 1?
Something between the items ended the list, usually a paragraph or code block that is not indented to the item's text. Indent that block under the item and the numbering continues.
Can I number a list with letters?
No. CommonMark only recognizes digits followed by . or ). Letter or roman styles come from the app or the page's CSS.
How many spaces should a nested list use?
Two under a - bullet and three under 1., matching the parent's text. Four spaces works in both cases.