Markdown Code Indented code blocks inside lists


Example

When adding indented code blocks inside a list you first need a blank line, then to indent the code further. Different flavours of Markdown have different rules for this.

  1. StackExchange requires code to be indented by 8 characters instead of the usual 4. (Spaces replaced with * for clarity):

     1.*Listitem1
     2.*Listitem2
     
     ********code here
     3.*Listitem3
    
  2. Specs such as CommonMark require that the code block be indented 4 characters from where the list item text starts. (Spaces replaced with * for clarity):

     1.****Listitem1
     2.****Listitem2
     
     **********code here
     3.****Listitem3