Whilst I tend to write page layouts and sections of this website in HTML, my wiki articles and blog posts are written in Markdown. Markdown enables me to write my articles and posts far more quickly than I could in HTML, without loosing any of the functionality I’ve required (at least not so far).
When putting together this wiki article on running Docker commands as a non-root user, I wanted to implement a multi-paragraph list that contained code snippets. An example is shown below.
This is my first item:
Want some code here
This is my second item:
More code here
A comment about the second lot of code.
A third item, which doesn’t reference any code.
A final item
Yet more code
1 Space, 2 Space, Tabs?
The markdown which generates the above list is thus as follows:
1. This is my first item: ```bash Want some code here ``` 1. This is my second item: ```bash More code here ``` A comment about the second lot of code. 1. A third item, which doesn't reference any code. 1. A final item ```bash Yet more code ```
In the above Markdown code snippet, note that all of my list items are donoted as 1. A number followed by a period indicates a list item, and, as long as your indentation is correct, each list item will be incremeneted appropriately. As stated in the markdown documentation:
It’s important to note that the actual numbers you use to mark the list have no effect on the HTML output Markdown produces.
This is called lazy list numbering. An important note about using lazy list numbering is provided in the documentation:
If you do use lazy list numbering, however, you should still start the list with the number 1. At some point in the future, Markdown may support starting ordered lists at an arbitrary number.