Lists
Lists are a fundamental part of markdown, allowing you to structure information clearly and concisely. Markdown supports ordered, unordered, and nested lists. Below are detailed examples and explanations for creating each type.
Ordered List
Ordered lists are used when the sequence of items is essential. To create an ordered list, start each line item with a number followed by a period (.
). Ensure the numbers are in sequence for better readability.
Example
- Step one: Gather materials.
- Step two: Begin assembly.
- Step three: Verify your work.
- Step four: Complete the project.
Markdown Code
1. Step one: Gather materials.
2. Step two: Begin assembly.
3. Step three: Verify your work.
4. Step four: Complete the project.
Unordered List
Unordered lists are ideal for items that do not follow a specific sequence. You can create an unordered list by prefixing each line with a dash (-
), an asterisk (*
), or a plus sign (+
).
Example
- Buy groceries
- Complete homework
- Attend meeting
- Exercise
Markdown Code
- Buy groceries
- Complete homework
- Attend meeting
- Exercise
* Buy groceries
* Complete homework
* Attend meeting
* Exercise
+ Buy groceries
+ Complete homework
+ Attend meeting
+ Exercise
Nested List
Nested lists are useful for adding sub-items or providing more detail under a main item. Indent sub-items by at least two spaces for proper rendering.
Example
- Vacation Planning
- Choose destination
- Book flights
- Reserve accommodations
- Packing List
- Clothes
- Casual wear
- Formal wear
- Electronics
- Clothes
Markdown code
- Vacation Planning
- Choose destination
- Book flights
- Reserve accommodations
- Packing List
- Clothes
- Casual wear
- Formal wear
- Electronics
Tables
Tables are a powerful way to present structured data. Markdown supports tables using hyphens (-
) for headers and pipes (|
) to separate columns. Tables improve the readability of tabular data in your documents.
Simple Table
Example
Item | Quantity | Price |
---|---|---|
Apples | 4 | $3.00 |
Bananas | 6 | $2.50 |
Cherries | 10 | $5.00 |
Markdown Code
| Item | Quantity | Price |
| ---------- | -------- | ------- |
| Apples | 4 | $3.00 |
| Bananas | 6 | $2.50 |
| Cherries | 10 | $5.00 |
Advanced Table with Alignment
You can align text in table columns using colons (:) in the header row.
:---
aligns text to the left.:---:
centers text.---:
aligns text to the right.
Example
Feature | Description | Status |
---|---|---|
Responsive | Adjusts to screen size | Enabled |
Cross-Browser | Works on all modern browsers | Yes |
Accessibility | Supports screen readers | Enabled |
Markdown code
| Feature | Description | Status |
| --------------- | ------------------------------------ | -------:|
| Responsive | Adjusts to screen size | Enabled |
| Cross-Browser | Works on all modern browsers | Yes |
| Accessibility | Supports screen readers | Enabled |
Tips for Creating Tables
- Ensure each row has the same number of columns.
- Use spaces around
|
for better readability in the markdown file. - Add a pipe (
|
) at the start and end of rows for compatibility across markdown processors. - By following this guide, you can effectively use lists and tables in markdown to present your content in an organized and visually appealing way.