In the following markdown code I want item 3
to start with list number 3. But because of the code block in between markdown starts this list item as a new list.
Use four spaces to indent content between bullet points
1. item 1
2. item 2
```
Code block
```
3. item 3
Produces:
item 2
Code block
Macmade's solution doesn't work for me anymore on my Jekyll instance on Github Pages anymore but I found this solution on an issue for the kramdown github repo. For OP's example it would look like this:
1. item 1
2. item 2
```
Code block
```
{:start="3"}
3. item 3
Solved my issues handily.
If you want to have text aligned to preceding list item but avoid having "big" line break, use two spaces at the end of a list item and indent the text with some spaces.
Source: (dots are spaces ;-) of course)
1.·item1··
····This is some text
2.item2
Result:
Put the list numbers in parentheses instead of followed by a period.
(1) item 1
(2) item 2
code block
(3) item 3
If you happen to be using the Ruby gem redcarpet to render Markdown, you may still have this problem.
You can escape the numbering, and redcarpet will happily ignore any special meaning:
1\. Some heading
text text
text text
text text
2\. Some other heading
blah blah
more blah blah
As an extension to existing answers. For those trying to continue a numbered list after something other than a code block. For example a second paragraph. Just indent the second paragraph by at least 1 space.
Markdown:
1. one
2. two
three
3. four
Output:
one
two
three
four