136 lines
3.1 KiB
Markdown
136 lines
3.1 KiB
Markdown
|
|
# Lists
|
||
|
|
Markdown supports ordered lists and unordered lists.
|
||
|
|
---
|
||
|
|
# Unordered Lists
|
||
|
|
Use asterisk `*` , plus sign `+` or hyphen `-` as markers. Add a space after the marker before writing content.
|
||
|
|
- item
|
||
|
|
- item
|
||
|
|
- item
|
||
|
|
---
|
||
|
|
# Ordered Lists
|
||
|
|
Ordered lists are used to display steps or items that require a specific sequence.
|
||
|
|
To create an ordered list, use a number followed by a period. Example:
|
||
|
|
1. First item
|
||
|
|
2. Second item
|
||
|
|
3. Third item
|
||
|
|
|
||
|
|
### Non-consecutive numbers
|
||
|
|
Markdown will automatically reorder the items even if the numbers are not consecutive:
|
||
|
|
`1. First item
|
||
|
|
3. Second item (displayed as 2)
|
||
|
|
7. Third item (displayed as 3)`
|
||
|
|
|
||
|
|
1. First item
|
||
|
|
3. Second item (displayed as 2)
|
||
|
|
7. Third item (displayed as 3)
|
||
|
|
|
||
|
|
### Start from a specified number
|
||
|
|
5. Fifth item
|
||
|
|
6. Sixth item
|
||
|
|
7. Seventh item
|
||
|
|
---
|
||
|
|
|
||
|
|
# Nested Lists
|
||
|
|
Lists support nesting to build multi-level structures.
|
||
|
|
|
||
|
|
### Nested Unordered Lists
|
||
|
|
- Fruits
|
||
|
|
- Apple
|
||
|
|
- Red apple
|
||
|
|
- Green apple
|
||
|
|
- Banana
|
||
|
|
- Orange
|
||
|
|
- Vegetables
|
||
|
|
- Carrot
|
||
|
|
- Chinese cabbage
|
||
|
|
|
||
|
|
### Nested Ordered Lists
|
||
|
|
1. Preparation
|
||
|
|
1. Collect materials
|
||
|
|
2. Make a plan
|
||
|
|
2. Implementation
|
||
|
|
1. Start execution
|
||
|
|
2. Monitor progress
|
||
|
|
3. Summary
|
||
|
|
|
||
|
|
### Mixed Nesting
|
||
|
|
1. Main tasks
|
||
|
|
- Subtask A
|
||
|
|
- Subtask B
|
||
|
|
1. Step 1
|
||
|
|
2. Step 2
|
||
|
|
- Subtask C
|
||
|
|
2. Minor tasks
|
||
|
|
|
||
|
|
Add 2 or 4 spaces before sub-list items to realize mixed nesting:
|
||
|
|
1. First item:
|
||
|
|
- First nested element
|
||
|
|
- Second nested element
|
||
|
|
2. Second item:
|
||
|
|
- First nested element
|
||
|
|
- Second nested element
|
||
|
|
|
||
|
|
### Nesting Rules
|
||
|
|
- Indent sub-lists with 2 to 4 spaces (2 spaces recommended)
|
||
|
|
- Keep the indentation consistent
|
||
|
|
- Nesting can be unlimited, but it is recommended to use no more than 3 levels in practice
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
# Task Lists (Checkbox Lists)
|
||
|
|
Task lists are an extended feature of GitHub Flavored Markdown and are widely supported nowadays.
|
||
|
|
|
||
|
|
### Basic Syntax
|
||
|
|
\- \[ \] Incomplete task
|
||
|
|
\- \[x\] Completed task
|
||
|
|
\- \[ \] Another incomplete task
|
||
|
|
|
||
|
|
### Practical Example
|
||
|
|
## Project To-do List
|
||
|
|
### Design Phase
|
||
|
|
- [x] Requirement analysis
|
||
|
|
- [x] Prototype design
|
||
|
|
- [ ] UI design
|
||
|
|
|
||
|
|
### Development Phase
|
||
|
|
- [ ] Front-end development
|
||
|
|
- [x] Page layout
|
||
|
|
- [ ] Interactive functions
|
||
|
|
- [ ] Responsive adaptation
|
||
|
|
- [ ] Back-end development
|
||
|
|
- [ ] Database design
|
||
|
|
- [ ] API development
|
||
|
|
- [ ] Performance optimization
|
||
|
|
|
||
|
|
### Testing Phase
|
||
|
|
- [ ] Unit testing
|
||
|
|
- [ ] Integration testing
|
||
|
|
- [ ] User acceptance testing
|
||
|
|
|
||
|
|
### Usage Tips
|
||
|
|
- The space and letter `x` inside the brackets are required: `[ ]` and `[x]`
|
||
|
|
- Task lists can be combined with nested lists
|
||
|
|
- Ideal for project management, study plans and daily checklists
|
||
|
|
- Checkboxes can be toggled by clicking in some editors
|
||
|
|
|
||
|
|
---
|
||
|
|
|
||
|
|
# Advanced List Skills
|
||
|
|
### Multiple paragraphs inside a list item
|
||
|
|
\> Blockquotes are also available inside list items
|
||
|
|
1. First item
|
||
|
|
|
||
|
|
This is the detailed description of the first item. Keep the content indented and aligned.
|
||
|
|
This is another paragraph.
|
||
|
|
|
||
|
|
2. Second item
|
||
|
|
|
||
|
|
> Blockquotes are also available inside list items
|
||
|
|
|
||
|
|
### Line breaks inside a list item
|
||
|
|
- This is a long list item.
|
||
|
|
Add indentation to wrap text on a new line.
|
||
|
|
- Another list item.
|
||
|
|
|
||
|
|
---
|