Markdown Nested Lists: Indent Bullets, Paragraphs and Code
Nest bullets inside numbered Markdown lists, keep paragraphs and code in the right step, and fix indentation with two tested examples.
On this page
01Copy a numbered list with bullets, a paragraph and code02Why step 10 needs a wider indentTo nest a Markdown list, indent the child marker to the column where the parent item's text starts. Under 1. , that is three spaces. Under 10. , it is four. The parent marker's width determines where its content begins.
This is also the place to align a continuation paragraph or a fenced code block that belongs to the parent item. Check the rendered list after pasting, because an editor can change indentation as you type. GitHub's nested list guide
The first step below contains two checks and a second paragraph. The second step contains a shell command. The third returns to the outer list.
## Publish a note
1. Prepare the draft.
- Check the title.
- Check the destination link.
Keep the source with the image.
2. Run the local check.
```sh
echo "Notes ready"
```
3. Share the preview.
Copy the Markdown inside the outer code fence. The inner shell fence belongs to the example. Keep the three leading spaces on its opening line, command and closing line.
When you preview the result, count three outer steps. The title and destination checks should sit below step one. The sentence about saving the source should stay inside that same step. The command box should appear under step two, followed by the third step at the outer level. Those checks help you spot a list that looks plausible but has the wrong structure.
The 1. marker uses three columns before its text starts. The 10. marker uses four. Align the child bullets with the parent's first word, as in this example.
10. Review the draft.
- Confirm the owner.
- Confirm the date.
11. Share the preview.
Here, the child markers have four leading spaces. The second outer item begins back at the left margin. If you copy the bullets from the first example beneath step 10, add one space to preserve that alignment.
For the common list form used here, CommonMark describes the content indent in terms of the marker width plus the spaces following it. That explains why a fixed indent can work in one example and fail after the marker changes. CommonMark list item rules
If several people edit the file, use spaces consistently and turn on your editor's whitespace display while fixing the list. A tab can look like several spaces but make the source harder to compare. After adding or removing a digit in a parent number, recheck its child lines, continuation paragraphs and code fences.
| What you see | What to inspect |
|---|---|
| Child bullets sit beside the numbered steps | Compare the child marker's column with the parent's first word. |
| A paragraph falls outside the step | Indent its first line to the parent's content column and preserve the blank line above it. |
| A command appears as ordinary text | Check both fence lines and their indentation inside the item. |
| Numbering starts over after a code block | Check whether the block or following paragraph ended the outer list. Bring the content back inside its parent. |
| The whole example appears as source code | Copy only the contents of the outer Markdown fence. Retain the inner shell fence. |
Fix the smallest fragment first. Start with two outer items and a single child, then add the paragraph and command back. Preview after each change. This makes it easier to see which indentation moved the content out of its parent.
Blank lines can also change spacing between list items. In the full example, they give the paragraph and command their own blocks. If the list becomes more spacious after you add a paragraph, inspect the structure before trying to remove every blank line.
We tested both examples in the live Markdown2Image editor. The main example produced three outer items, two child bullets under the first, and a code block under the second. The second example started at 10 and kept its two bullets nested.
The PNG below was downloaded from that editor using the full example. Use it to compare the indentation in a slide or documentation review. Keep the Markdown with the image so the next edit preserves the structure. For readers who need to run the command, include the source or a document link beside the picture. Try the nested list in Markdown2Image