If you want to add a block of code to a list item, you have to add an extra 4 spaces for every level of that list. You also have to make sure that you leave a blank line before the code block.
code block outside of a list
Main list
code block
sub list
code block
second code block
sub2 list
code block
sub3 list
code block
up two list levels
# 4↴
code block outside of a list
- Main list
# 8↴
code block
# 4↴
- sub list
# 12↴
code block
# 8↴
<!-- --> # can also be used to set highlighting <!-- language: lang-none -->
# 12↴
second code block
# 8↴
- sub<sup>2</sup> list
# 16↴
code block
# 12↴
- sub<sup>3</sup> list
# 20↴
code block
# 8↴
<!-- -->
# 12↴
up two list levels
If you need to force the Markdown processor to start a new section, just add a <p/>
or <!-- -->
on it's own line at the appropriate level. That's how I managed to follow a list with a code block for this answer.
If you do use <!-- -->
you can use it to set the highlighting mode for the following code block as well (<!-- language: lang-none -->
)If you do use <!-- -->
you can use it to set the highlighting mode for the following code block as well (<!-- language: lang-none -->
).