Markdown Lists
Lists are an important way to organize information. Markdown supports ordered lists, unordered lists, and task lists. This chapter will detail various uses of lists.
Unordered Lists
Basic Syntax
Use -, +, or * to create unordered lists:
- Item one
- Item two
- Item threeEffect:
- Item one
- Item two
- Item three
Different Markers
All three markers have the same effect:
- Using dash
+ Using plus
* Using asteriskEffect:
- Using dash
- Using plus
- Using asterisk
Best Practices
It's recommended to use the same symbol throughout the document:
✅ Recommended (unified use of -)
- Item one
- Item two
- Item three
❌ Not Recommended (mixed use)
- Item one
+ Item two
* Item threeOrdered Lists
Basic Syntax
Use numbers followed by . to create ordered lists:
1. First item
2. Second item
3. Third itemEffect:
- First item
- Second item
- Third item
Auto Numbering
Numbers don't need to be in order, Markdown will automatically number them:
1. First item
1. Second item
1. Third itemEffect:
- First item
- Second item
- Third item
Specify Starting Number
5. Fifth item
6. Sixth item
7. Seventh itemEffect:
- Fifth item
- Sixth item
- Seventh item
Nested Lists
Unordered List Nesting
Use indentation (2 or 4 spaces) to create nesting:
- Main item
- Sub item 1
- Sub item 2
- Sub sub item 1
- Sub sub item 2
- Another main itemEffect:
- Main item
- Sub item 1
- Sub item 2
- Sub sub item 1
- Sub sub item 2
- Another main item
Ordered List Nesting
1. First item
1. Sub item 1.1
2. Sub item 1.2
2. Second item
1. Sub item 2.1
2. Sub item 2.2Effect:
- First item
- Sub item 1.1
- Sub item 1.2
- Second item
- Sub item 2.1
- Sub item 2.2
Mixed Nesting
1. Ordered item
- Unordered sub item
- Another unordered sub item
2. Another ordered item
1. Ordered sub item
2. Another ordered sub itemEffect:
- Ordered item
- Unordered sub item
- Another unordered sub item
- Another ordered item
- Ordered sub item
- Another ordered sub item
Paragraphs in Lists
Single Paragraph
Add a paragraph in a list item, use indentation:
- First item
This is a detailed description paragraph of the first item.
- Second item
This is a detailed description paragraph of the second item.Multiple Paragraphs
1. First item
First paragraph description.
Second paragraph description.
2. Second item
First paragraph description.Code Blocks in Lists
Inline Code
- Use `git add` to add files
- Use `git commit` to commit changes
- Use `git push` to push to remoteEffect:
- Use
git addto add files - Use
git committo commit changes - Use
git pushto push to remote
Code Blocks
Use 8 spaces or 2 tabs for indentation:
1. Install dependencies
```bash
npm install
```
2. Start service
```bash
npm start
```Quotes in Lists
- First item
> This is a quoted text.
> Can have multiple lines.
- Second itemEffect:
First item
This is a quoted text. Can have multiple lines.
Second item
Images in Lists
1. First step

2. Second step
Task Lists
Basic Syntax
Use - [ ] and - [x] to create task lists:
- [x] Completed task
- [ ] Incomplete task
- [ ] Another incomplete taskEffect:
- [x] Completed task
- [ ] Incomplete task
- [ ] Another incomplete task
Nested Task Lists
- [x] Main task
- [x] Subtask 1
- [ ] Subtask 2
- [ ] Another main task
- [ ] Subtask 1
- [ ] Subtask 2Effect:
- [x] Main task
- [x] Subtask 1
- [ ] Subtask 2
- [ ] Another main task
- [ ] Subtask 1
- [ ] Subtask 2
Task List Applications
## Project Todo List
- [x] Complete requirements analysis
- [x] Design database
- [ ] Develop backend API
- [x] User module
- [ ] Order module
- [ ] Payment module
- [ ] Develop frontend interface
- [ ] Testing
- [ ] DeploymentDefinition Lists
Some Markdown extensions support definition lists:
Term1
: Definition1
Term2
: Definition2a
: Definition2bOr use HTML:
<dl>
<dt>Term1</dt>
<dd>Definition1</dd>
<dt>Term2</dt>
<dd>Definition2</dd>
</dl>List Styles
Use Emojis
- ✅ Completed
- ⏳ In Progress
- ❌ Cancelled
- 📝 PendingEffect:
- ✅ Completed
- ⏳ In Progress
- ❌ Cancelled
- 📝 Pending
Use Icons
- 🎯 Goal
- 💡 Idea
- ⚠️ Warning
- 📌 ImportantEffect:
- 🎯 Goal
- 💡 Idea
- ⚠️ Warning
- 📌 Important
List Best Practices
1. Keep Indentation Consistent
✅ Recommended
- Main item
- Sub item (2 spaces)
- Sub sub item (4 spaces)
❌ Not Recommended
- Main item
- Sub item (3 spaces)
- Sub sub item (5 spaces)2. Blank Lines Before and After Lists
✅ Recommended
This is a paragraph.
- List item 1
- List item 2
This is another paragraph.
❌ Not Recommended
This is a paragraph.
- List item 1
- List item 2
This is another paragraph.3. Keep it Concise
✅ Recommended
- Install Node.js
- Configure environment variables
- Run project
❌ Not Recommended
- First you need to download and install Node.js from the official website, then...4. Use Nesting Reasonably
Don't nest too deep (recommended no more than 3 levels):
✅ Recommended
- Level 1
- Level 2
- Level 3
❌ Not Recommended
- Level 1
- Level 2
- Level 3
- Level 4
- Level 5 (too deep)List Application Scenarios
1. Step Instructions
## Installation Steps
1. Download installation package
2. Extract files
3. Run installation program
4. Complete configuration2. Feature Lists
## Main Features
- User management
- Permission control
- Data statistics
- Report export3. Todo Items
## Today's Tasks
- [ ] Reply to emails
- [ ] Complete report
- [x] Attend meeting
- [ ] Code review4. Pros and Cons Comparison
## Advantages
- Simple and easy to use
- Excellent performance
- Active community
## Disadvantages
- Steep learning curve
- Incomplete documentation5. Directory Structure
## Project Structure
- src/
- components/
- utils/
- styles/
- public/
- tests/
- README.mdLists Combined with Other Elements
Lists + Links
- [GitHub](https://github.com)
- [Stack Overflow](https://stackoverflow.com)
- [MDN](https://developer.mozilla.org)Lists + Bold
- **Important**: This is important content
- **Note**: This needs attention
- **Tip**: This is a tipLists + Code
- Install: `npm install`
- Start: `npm start`
- Build: `npm run build`Common Questions
Spacing Between List Items
If you need more spacing between list items, add blank lines between items:
- First item
- Second item
- Third itemList Number Reset
If a list is interrupted by other content, numbering will reset:
1. First item
2. Second item
This is a paragraph.
1. Numbering restarts
2. Second itemSpecial Characters in Lists
If a list item starts with a number and a dot, escape it:
- 1984\. This is a book
- 2024\. This is a yearShortcuts
VS Code
Ctrl/Cmd + Shift + ]: Increase indentationCtrl/Cmd + Shift + [: Decrease indentation
Typora
Ctrl/Cmd + ]: Increase indentationCtrl/Cmd + [: Decrease indentationCtrl/Cmd + Shift + X: Toggle task status
Practice Exercises
Try creating the following lists:
- An unordered list with 3 items
- An ordered list with 5 steps
- A list with nested items
- A task list (with completed and incomplete items)
- A list containing code and links
Summary
Lists are one of the most commonly used features in Markdown. Mastering lists can:
- Clearly organize information
- Show steps and processes
- Manage tasks and todo items
- Create tables of contents and navigation
Next: Learn detailed usage of Markdown Blockquotes.