Skip to content

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:

markdown
- Item one
- Item two
- Item three

Effect:

  • Item one
  • Item two
  • Item three

Different Markers

All three markers have the same effect:

markdown
- Using dash
+ Using plus
* Using asterisk

Effect:

  • Using dash
  • Using plus
  • Using asterisk

Best Practices

It's recommended to use the same symbol throughout the document:

markdown
✅ Recommended (unified use of -)
- Item one
- Item two
- Item three

❌ Not Recommended (mixed use)
- Item one
+ Item two
* Item three

Ordered Lists

Basic Syntax

Use numbers followed by . to create ordered lists:

markdown
1. First item
2. Second item
3. Third item

Effect:

  1. First item
  2. Second item
  3. Third item

Auto Numbering

Numbers don't need to be in order, Markdown will automatically number them:

markdown
1. First item
1. Second item
1. Third item

Effect:

  1. First item
  2. Second item
  3. Third item

Specify Starting Number

markdown
5. Fifth item
6. Sixth item
7. Seventh item

Effect:

  1. Fifth item
  2. Sixth item
  3. Seventh item

Nested Lists

Unordered List Nesting

Use indentation (2 or 4 spaces) to create nesting:

markdown
- Main item
  - Sub item 1
  - Sub item 2
    - Sub sub item 1
    - Sub sub item 2
- Another main item

Effect:

  • Main item
    • Sub item 1
    • Sub item 2
      • Sub sub item 1
      • Sub sub item 2
  • Another main item

Ordered List Nesting

markdown
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.2

Effect:

  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.2

Mixed Nesting

markdown
1. Ordered item
   - Unordered sub item
   - Another unordered sub item
2. Another ordered item
   1. Ordered sub item
   2. Another ordered sub item

Effect:

  1. Ordered item
    • Unordered sub item
    • Another unordered sub item
  2. Another ordered item
    1. Ordered sub item
    2. Another ordered sub item

Paragraphs in Lists

Single Paragraph

Add a paragraph in a list item, use indentation:

markdown
- 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

markdown
1. First item

   First paragraph description.

   Second paragraph description.

2. Second item

   First paragraph description.

Code Blocks in Lists

Inline Code

markdown
- Use `git add` to add files
- Use `git commit` to commit changes
- Use `git push` to push to remote

Effect:

  • Use git add to add files
  • Use git commit to commit changes
  • Use git push to push to remote

Code Blocks

Use 8 spaces or 2 tabs for indentation:

markdown
1. Install dependencies

   ```bash
   npm install
   ```

2. Start service

   ```bash
   npm start
   ```

Quotes in Lists

markdown
- First item

  > This is a quoted text.
  > Can have multiple lines.

- Second item

Effect:

  • First item

    This is a quoted text. Can have multiple lines.

  • Second item

Images in Lists

markdown
1. First step

   ![Image description](Image URL)

2. Second step

   ![Another image](Image URL)

Task Lists

Basic Syntax

Use - [ ] and - [x] to create task lists:

markdown
- [x] Completed task
- [ ] Incomplete task
- [ ] Another incomplete task

Effect:

  • [x] Completed task
  • [ ] Incomplete task
  • [ ] Another incomplete task

Nested Task Lists

markdown
- [x] Main task
  - [x] Subtask 1
  - [ ] Subtask 2
- [ ] Another main task
  - [ ] Subtask 1
  - [ ] Subtask 2

Effect:

  • [x] Main task
    • [x] Subtask 1
    • [ ] Subtask 2
  • [ ] Another main task
    • [ ] Subtask 1
    • [ ] Subtask 2

Task List Applications

markdown
## Project Todo List

- [x] Complete requirements analysis
- [x] Design database
- [ ] Develop backend API
  - [x] User module
  - [ ] Order module
  - [ ] Payment module
- [ ] Develop frontend interface
- [ ] Testing
- [ ] Deployment

Definition Lists

Some Markdown extensions support definition lists:

markdown
Term1
: Definition1

Term2
: Definition2a
: Definition2b

Or use HTML:

markdown
<dl>
  <dt>Term1</dt>
  <dd>Definition1</dd>
  <dt>Term2</dt>
  <dd>Definition2</dd>
</dl>

List Styles

Use Emojis

markdown
- ✅ Completed
- ⏳ In Progress
- ❌ Cancelled
- 📝 Pending

Effect:

  • ✅ Completed
  • ⏳ In Progress
  • ❌ Cancelled
  • 📝 Pending

Use Icons

markdown
- 🎯 Goal
- 💡 Idea
- ⚠️ Warning
- 📌 Important

Effect:

  • 🎯 Goal
  • 💡 Idea
  • ⚠️ Warning
  • 📌 Important

List Best Practices

1. Keep Indentation Consistent

markdown
✅ 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

markdown
✅ 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

markdown
✅ 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):

markdown
✅ 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

markdown
## Installation Steps

1. Download installation package
2. Extract files
3. Run installation program
4. Complete configuration

2. Feature Lists

markdown
## Main Features

- User management
- Permission control
- Data statistics
- Report export

3. Todo Items

markdown
## Today's Tasks

- [ ] Reply to emails
- [ ] Complete report
- [x] Attend meeting
- [ ] Code review

4. Pros and Cons Comparison

markdown
## Advantages

- Simple and easy to use
- Excellent performance
- Active community

## Disadvantages

- Steep learning curve
- Incomplete documentation

5. Directory Structure

markdown
## Project Structure

- src/
  - components/
  - utils/
  - styles/
- public/
- tests/
- README.md

Lists Combined with Other Elements

markdown
- [GitHub](https://github.com)
- [Stack Overflow](https://stackoverflow.com)
- [MDN](https://developer.mozilla.org)

Lists + Bold

markdown
- **Important**: This is important content
- **Note**: This needs attention
- **Tip**: This is a tip

Lists + Code

markdown
- 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:

markdown
- First item

- Second item

- Third item

List Number Reset

If a list is interrupted by other content, numbering will reset:

markdown
1. First item
2. Second item

This is a paragraph.

1. Numbering restarts
2. Second item

Special Characters in Lists

If a list item starts with a number and a dot, escape it:

markdown
- 1984\. This is a book
- 2024\. This is a year

Shortcuts

VS Code

  • Ctrl/Cmd + Shift + ]: Increase indentation
  • Ctrl/Cmd + Shift + [: Decrease indentation

Typora

  • Ctrl/Cmd + ]: Increase indentation
  • Ctrl/Cmd + [: Decrease indentation
  • Ctrl/Cmd + Shift + X: Toggle task status

Practice Exercises

Try creating the following lists:

  1. An unordered list with 3 items
  2. An ordered list with 5 steps
  3. A list with nested items
  4. A task list (with completed and incomplete items)
  5. 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.

Content is for learning and research only.