Ordered Lists & Nested Outlines
Ordered lists represent numbered, sequential steps where order matters—such as installation tutorials, recipe steps, or algorithmic procedures.
1. Basic Ordered List Syntax
To create an ordered list, prefix each line with a number followed by a period (.) or parenthesis ()), and a space:
- HTML Output:
<ol><li>Clone the repository</li><li>...</li></ol>
2. The Auto-Numbering Magic of Markdown
One of Markdown's greatest conveniences is that you do not need to manually calculate numbers! The parser will automatically re-number the items consecutively on render:
Rendered Output in Browser:
- 1First step
- 2Second step
- 3Third step
- 4Fourth step
1.? If you later insert a new step in the middle of a 20-step tutorial, you do not need to manually renumber the remaining 19 steps!3. Starting at an Offset Number
In CommonMark and GFM, the first number determines the starting index of the HTML list (<ol start="X">):
This will render starting from number 10, rather than 1!
4. Multi-Level Mixed Outlines
You can freely mix ordered and unordered lists to build complex hierarchical outlines:
Multiple Choice Questions
1. What HTML tag is generated by an ordered list in Markdown?
A. <ul> B. <ol> C. <li> D. <dl> Answer: B Explanation: Ordered numbered lists compile to an HTML <ol> (Ordered List) container.
2. If you write an ordered list with '1. Apple', '1. Banana', '1. Orange', how will it render in the browser?
A. All items will be numbered 1. B. It will automatically render consecutively as 1. Apple, 2. Banana, 3. Orange C. It will throw a syntax error D. It will convert to bullet points Answer: B Explanation: Markdown parsers automatically compute consecutive sequential numbers regardless of the actual digits typed in source.
3. How can you start an ordered list from the number 5 instead of 1?
A. Type 'start=5' on top B. Begin the first item with '5.' (e.g. '5. Fifth item') C. Press Tab five times D. You cannot change the starting number in Markdown Answer: B Explanation: In CommonMark and GFM, the first number in the list sets the HTML <ol start="..."> attribute.
4. How do you indent a nested ordered list beneath a parent list item?
A. Press Spacebar 2 or 4 times B. Put a hash (#) in front C. Insert an HTML <table> D. Type 'nested' Answer: A Explanation: Indenting child items by 2 or 4 spaces creates a subordinate nested list level.
5. Besides a period ('1.'), which other punctuation mark is valid after a number in CommonMark ordered lists?
A. Right parenthesis ('1)') B. Comma ('1,') C. Semicolon ('1;') D. Question mark ('1?') Answer: A Explanation: CommonMark permits both a period (1.) and a right parenthesis (1)) as ordered list delimiters.
Task Lists & Interactive Checkboxes
Continue learning with hands-on practice, examples, and exercises in the upcoming topic.
Related Lessons
| Previous Lesson | Next Lesson |
|---|---|
| Unordered Lists & Bullet Customization | Task Lists & Interactive Checkboxes |
Practice Quiz
Test your understanding of this lesson with 5 questions. Each question has one correct answer.