Skip to main content
replaced http://meta.stackoverflow.com/ with https://meta.stackoverflow.com/
Source Link

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 -->).

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 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 -->).

Post Made Community Wiki by animusonStaffMod
Updated to show more possibilities.
Source Link
Brad Gilbert
  • 11.7k
  • 2
  • 37
  • 53

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
code block outside of a list
  • Main list

      code block
    
      code block
    
    • sub list

        code block
      
        code block
      
        second code block
      
      • sub sub2 list

          code block
        
          code block
        
        • sub sub sub3 list

            code block
          
            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↴
        - sub sub list
#            16↴
                code block

#        12↴
            - sub sub sub list
#                20↴
                    code block
# 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 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.

code block outside of a list
  • Main list

      code block
    
    • sub list

        code block
      
      • sub sub list

          code block
        
        • sub sub sub list

            code block
          
# 4↴
    code block outside of a list

- Main list
#     8↴
        code block

# 4↴
    - sub list
#        12↴
            code block

#     8↴
        - sub sub list
#            16↴
                code block

#        12↴
            - sub sub sub list
#                20↴
                    code block

If you need to force the Markdown processor to start a new section, just add a <p/> on it's own line. That's how I managed to follow a list with a code block, for this answer.

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 -->).

Used arrows instead of v.
Source Link
Brad Gilbert
  • 11.7k
  • 2
  • 37
  • 53

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.

code block outside of a list
  • Main list

      code block
    
    • sub list

        code block
      
      • sub sub list

          code block
        
        • sub sub sub list

            code block
          
#  4v4↴
    code block outside of a list

- Main list
#  4   8v8↴
        code block 

# 4↴
    - sub list
#      8  12v12↴
            code block 

#     8↴
        - sub sub list
#         12  16v 16↴
                code block 

#        12↴
            - sub sub sub list
#             16  20v 20↴
                    code block

If you need to force the Markdown processor to start a new section, just add a <p/> on it's own line. That's how I managed to follow a list with a code block, for this answer.

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.

code block outside of a list
  • Main list

      code block
    
    • sub list

        code block
      
      • sub sub list

          code block
        
        • sub sub sub list

            code block
          
#  4v
    code block outside of a list

- Main list
#  4   8v
        code block

    - sub list
#      8  12v
            code block

        - sub sub list
#         12  16v
                code block

            - sub sub sub list
#             16  20v
                    code block

If you need to force the Markdown processor to start a new section, just add a <p/> on it's own line. That's how I managed to follow a list with a code block, for this answer.

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.

code block outside of a list
  • Main list

      code block
    
    • sub list

        code block
      
      • sub sub list

          code block
        
        • sub sub sub list

            code block
          
# 4↴
    code block outside of a list

- Main list
#     8↴
        code block 

# 4↴
    - sub list
#        12↴
            code block 

#     8↴
        - sub sub list
#            16↴
                code block 

#        12↴
            - sub sub sub list
#                20↴
                    code block

If you need to force the Markdown processor to start a new section, just add a <p/> on it's own line. That's how I managed to follow a list with a code block, for this answer.

Source Link
Brad Gilbert
  • 11.7k
  • 2
  • 37
  • 53
Loading