Markdown: continue numbered list
Categories:
Markdown: Seamlessly Continue Numbered Lists
Learn the simple yet crucial techniques to continue numbered lists in Markdown, ensuring consistent and well-formatted documentation across various platforms.
Numbered lists are a fundamental part of organizing information in Markdown. However, a common challenge arises when you need to break a list with other content (like a code block or an image) and then continue the numbering from where you left off. This article explores the standard Markdown behavior and provides practical solutions to ensure your lists remain coherent and correctly sequenced.
Understanding Markdown's Default List Behavior
By default, Markdown parsers are quite forgiving with numbered lists. If you start a new list item with 1.
after an interruption, most parsers will intelligently pick up the numbering from the last item of the previous list. However, this behavior can be inconsistent across different Markdown renderers, and explicitly indicating your intention is often better for clarity and reliability.
1. First item
2. Second item
Some intervening paragraph.
1. Third item (automatically continues from 2)
2. Fourth item
Markdown's default list continuation behavior
Explicitly Continuing Numbered Lists
The most reliable way to continue a numbered list after an interruption is to explicitly specify the starting number for the next list segment. Markdown allows you to start a list with any number, and subsequent items will increment from there. This makes it straightforward to pick up exactly where you left off.
1. Step one
2. Step two
```javascript
console.log("This is a code block.");
- Step three (explicitly starts from 3)
- Step four
*Using explicit numbering to continue a list*

*Flowchart: Continuing Markdown Numbered Lists*
Be mindful of the indentation when continuing lists. Incorrect indentation can break the list structure or cause items to be rendered as regular paragraphs or sub-items.
## Best Practices for Long Documents
For longer technical articles or documentation with numerous lists and interruptions, maintaining readability and editability is key. Always prefer explicit numbering for continuation, especially when the interruption is significant (e.g., multiple paragraphs, images, or extensive code examples). This practice makes the intent clear to anyone reading or editing the Markdown source.
### 1. Step 1
Start your initial numbered list as usual.
### 2. Step 2
When you need to insert non-list content (like an image or code block), place it between the list segments.
### 3. Step 3
Identify the next logical number for your list to continue.
### 4. Step 4
Start the new list segment with that specific number, followed by a period and a space (e.g., `3.`, `4.`).
### 5. Step 5
Continue adding list items as needed, and Markdown will increment the numbers automatically from your specified start point.
By following these simple guidelines, you can ensure that your Markdown numbered lists are always clear, correctly formatted, and easily understood, regardless of the Markdown renderer in use. This approach enhances the quality and maintainability of your documentation.