Here is a quick guide to creating lists with Markdown. First I'll show you how to create a bullet lists with markdown, also known as ul lists in HTML, or unordered lists. Then I'll show you how to create a markdown numbered list, or an ordered list.
Markdown Bullet List Example
To create a markdown bullet list start the line with either a *
character, the +
or a -
character. It doesn't matter which one you pick,
as long as you start the line with a *
, a +
or a -
character markdown will interpret that as an unordered list item.
The following markdown segment:
* One * Two
Will produce a bullet list that looks like this:
- One
- Two
As already mentioned we can use a -
or +
to start an unordered list in Markdown as well:
- One - Two
All three leading characters will produce the same list as above, but the *
character tends to be the most popular choice.
What about nested bullet lists?
To create a nested UL list just indent the line with a tab or 3-4 spaces. For example the following markdown:
* One * Two * Three * Four
Will render as the following:
- One
- Two
- Three
- Four
- Three
Can you Mix *
+
and -
?
You certainly can, the following will render the same list nested bullet list as above:
* One * Two + Three - Four
Some linters may suggest that you start your nested list with a *
, but any of the three unordered list characters should work just fine.
Markdown Numbered Lists
You can create numbered lists in markdown by prefixing each line with incrementing numbers followed by a period. For example:
1. One 2. Two
The above markdown segment results in the following ordered list. The ordered or numbered markdown list renders in HTML using the OL
tag:
- One
- Two
That's pretty much all I know about markdown lists, did I miss anything?
Comments
I would add that ordered lists can have an optional start argument that is useful when you want to break out of a list to include other data elements and then resume the same lost with a new ol.
One nice thing about ordered lists in markdown: you don't have to use sequential numbers. You can use the same number repeatedly, have gaps between numbers, or random numbers. It will render as 1, 2, 3, etc. automatically.