Reputation: 2867
What is the best way to create a numbered list in Markdown format? I currently have to manually enter the number I want to appear, but if I add items, I have to renumber them all.
Upvotes: 127
Views: 83933
Reputation: 234
If you need add any comment/description/whatever under an item in the list. Only this option solved my case.
<ol>
<li>option 1</li>
Description
<li>option 2</li>
// Code example require empty line between and 4 spaces in front of the code line
Hello World!
<li>option 3</li>
</ol>
Result:
// Code example require empty line between and 4 spaces in front of the code line
Hello World!
Upvotes: -1
Reputation: 3629
OP's Question is easy to solve by adding a number with a dot then a space after. eg: 1.
we can keep use the same 1.
for all the items so we don't have to number everything manually and even if you remove the second item you don't have to rename all numbers below
But I faced a problem while creating a GitHub gist. auto numbering was not working if i have a code block between them.
// a sample code block
3.
)in order to solve this you need to add four spaces to indent content between bullet points
// a sample code block
Note: you can click on the "edit" button below on this answer to see the underlying Markdown code but click on the cancel button instead of save!
Upvotes: 8
Reputation: 151
if you type the first one with a one like this 1. lorem
then as long as
the rest have a space after the dot then it should work
1. lorem
4. hello
3. blah blah blah
you should get this:
Upvotes: 15
Reputation: 72671
That should happen automatically (at least in SO flavored MD):
The code I used it:
1. test 1
1. test 2
The same works for GitHub flavored MD: https://gist.github.com/3489721
You can test it here: https://meta.stackexchange.com/questions/3122/formatting-sandbox
Upvotes: 155