Markdown Bullet List with Code Examples
Markdown is a popular text formatting syntax used to format documents and make them easily readable on the web. It was created in 2004 by John Gruber as a way to write in an easy-to-read format and have it transformed into a structured HTML document.
One of the most useful features of Markdown is the ability to create bullet lists. Bullet lists are useful to organize and structure text into a concise and readable format. They are commonly used for creating outlines, task lists, and to-do lists.
In this article, we will discuss the basics of creating bullet lists in Markdown and provide code examples to illustrate the different types of bullet lists that can be created.
Unordered Bullet Lists
Unordered bullet lists are created using asterisks (*), plus signs (+), or hyphens (-) as bullet points. These bullet points can be used interchangeably, and the choice of which symbol to use is a matter of personal preference.
Here is an example of an unordered bullet list using asterisks:
* Item 1
* Item 2
* Item 3
Result:
- Item 1
- Item 2
- Item 3
Here is an example of an unordered bullet list using plus signs:
+ Item 1
+ Item 2
+ Item 3
Result:
- Item 1
- Item 2
- Item 3
Here is an example of an unordered bullet list using hyphens:
- Item 1
- Item 2
- Item 3
Result:
- Item 1
- Item 2
- Item 3
Ordered Bullet Lists
Ordered bullet lists are created using numbers followed by a period (.) to indicate the order of items in the list.
Here is an example of an ordered bullet list:
1. Item 1
2. Item 2
3. Item 3
Result:
- Item 1
- Item 2
- Item 3
Note that the numbers do not have to be consecutive. For example, if you want to skip a number, you can simply start the next item with the next number.
1. Item 1
2. Item 2
4. Item 3
Result:
- Item 1
- Item 2
- Item 3
Nested Bullet Lists
Nested bullet lists can be created by indenting the items that belong to a sub-list. Nested bullet lists can be either ordered or unordered.
Here is an example of a nested unordered bullet list:
- Item 1
* Sub-item 1
* Sub-item 2
- Item 2
* Sub-item 1
* Sub-item 2
Result:
- Item 1
- Sub-item 1
- Sub-item 2
- Item 2
- Sub-item 1
- Sub-item 2
Here is an example of a nested ordered bullet list:
1. Item 1
1. Sub-item 1
2. Sub-item 2
2. Item 2
1. Sub-item 1
2. Sub-item 2
Result:
- Item 1
- Sub-item 1
- Sub-item 2
- Item 2
- Sub-item
Task Lists
Task lists are a special type of bullet list that can be used to keep track of tasks and their completion status. Task lists use square brackets ([]), followed by a space and either an x or a blank, to indicate the completion status of a task. An x indicates that the task is complete, while a blank indicates that it is still in progress.
Here is an example of a task list:
- [x] Task 1
- [ ] Task 2
- [x] Task 3
Result:
- [x] Task 1
- [ ] Task 2
- [x] Task 3
Task lists can be used in combination with other types of bullet lists, such as ordered or nested bullet lists.
Code Blocks
Code blocks in Markdown are used to display code or text in a monospace font. They can be created by placing three backticks (“`) before and after the code block. Optionally, you can specify the programming language after the opening backticks, to enable syntax highlighting.
Here is an example of a code block:
This is a code block
Result:
This is a code block
Code blocks are often used in technical documentation, or to display examples of code in tutorials or articles.
Blockquotes
Blockquotes in Markdown are used to set apart a block of text from the rest of the document. They are created by placing a greater-than symbol (>) before each line of the blockquote.
Here is an example of a blockquote:
> This is a blockquote
> It can span multiple lines
Result:
This is a blockquote
It can span multiple lines
Blockquotes are often used to provide quotes from other sources, or to set apart text that needs to be emphasized.
Conclusion
Markdown bullet lists are a powerful tool for organizing and structuring text in a concise and readable format. With the ability to create unordered, ordered, and nested bullet lists, as well as task lists, code blocks, and blockquotes, Markdown provides a versatile and flexible way to format text for the web. Whether you're writing a blog post, a technical document, or just a simple to-do list, Markdown bullet lists are an essential tool that every writer should be familiar with.
Popular questions
- What is a Markdown bullet list?
A Markdown bullet list is a way to format text in a list format, with each item in the list marked by a bullet point. In Markdown, unordered bullet lists are created by placing a hyphen (-) or asterisk (*) before each item in the list.
- What is a nested bullet list in Markdown?
A nested bullet list in Markdown is a bullet list within another bullet list. This is useful for creating sub-lists or for organizing information into a hierarchical structure. In Markdown, a nested bullet list is created by placing four spaces before the bullet point for each level of indentation.
- How do you create a task list in Markdown?
A task list in Markdown is a special type of bullet list that can be used to keep track of tasks and their completion status. Task lists use square brackets ([]), followed by a space and either an x or a blank, to indicate the completion status of a task. An x indicates that the task is complete, while a blank indicates that it is still in progress.
- What is a code block in Markdown?
A code block in Markdown is used to display code or text in a monospace font. They can be created by placing three backticks (“`) before and after the code block. Optionally, you can specify the programming language after the opening backticks, to enable syntax highlighting.
- What is a blockquote in Markdown?
A blockquote in Markdown is used to set apart a block of text from the rest of the document. They are created by placing a greater-than symbol (>) before each line of the blockquote. Blockquotes are often used to provide quotes from other sources, or to set apart text that needs to be emphasized.
Tag
Markdown.