Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to prevent/disable automatic list number incrementing in markdown?

How can I disable auto-incrementing list numbers in a markdown file?

What I'm trying to display:

1.first
2.second
2.second
3.third

What is being displayed:

1.first
2.second
3.second
4.third

Is there an easy way to disable this?

like image 579
Don P Avatar asked Jun 18 '18 19:06

Don P


People also ask

How do I create a numbered list in Github readme?

Insert a horizontal divider with “***”. The table of contents can be structured with an ordered list in the readme.md. Simply insert the corresponding number at the start of the row and the list is created.

How do I create a markdown list?

To create an unordered list, add dashes ( - ), asterisks ( * ), or plus signs ( + ) in front of line items. Indent one or more items to create a nested list.


2 Answers

Experimenting revealed I can prevent this behavior by escaping the period:

1\.first 
2\.second 
2\.second 
3\.third
like image 141
Don P Avatar answered Sep 29 '22 04:09

Don P


I've faced similar issue recently and found @Don P answer helpful. Playing with this feature in Jupyter Notebook I found out that in cases like this it's enough to put backslash only in first row - this may be more convenient for long lists.

1\. first\
2. second\
2. second\
3. third

Your example shouldn't result in numbered list, as it requires to put space after number (note spaces after dots in my code snippet).

Also if you are creating list manually, it requires manual line breaks - (double space) or \ at the end of every line expect the last. I used \ in the example as it is visible.

like image 42
apawelek Avatar answered Sep 29 '22 02:09

apawelek