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.
Notice how in Macmade's solution, you can see an extra line of code above the "Code block".
Here are two better solutions:
Indent the code block by an extra 4 spaces (so usually 8, in this nested list example, 12). This will put the code in a element. On SO, you can even specify syntax highlight with a
indented by 4 spaces (+1 here due to the nested list).
item 2
Code.block('JavaScript', maybe)?
item 3
Or, just put the Code block within backticks and indent by 4 spaces (here, 1 extra because of the nested list). You'll get a regular indented text paragraph, with a element inside it. This one you can't syntax-highlight:
item 2
Code block
item 3
Note: you can click "edit" on this answer to see the underlying Markdown code. No need to save ;)