Skip to main content
Correct indent to 7 spaces; see CommonMark spec for how list items work (i.e., match the indent to the start of the list item text, then add any formatting).
Source Link
Makyen
  • 25.9k
  • 8
  • 50
  • 87
1. Item One
2. Item Two, for example:

    ```
    private bool Test()
    {
        return this.IFeelLucky;
    }
    ```

3. Item Three

works:

  1. Item One

  2. Item Two, for example:

    private bool Test()
    {
        return this.IFeelLucky;
    }
    
  3. Item Three

Or indent 8four more spaces insteadbeyond what's needed to indicate that the line is within the list item. In this example, that's 7 spaces: 3 spaces to line the start of using backticksthe text up with the list item indent (here, the three characters of "2. "), plus 4 additional spaces to indicate the lines are code, for a total of 7 spaces:

1. Item One
2. Item Two, for example:

        private bool Test()
        {
            return this.IFeelLucky;
        }

3. Item Three

Like this:

  1. Item One

  2. Item Two, for example:

     private bool Test()
     {
         return this.IFeelLucky;
     }
    
  3. Item Three

1. Item One
2. Item Two, for example:

    ```
    private bool Test()
    {
        return this.IFeelLucky;
    }
    ```

3. Item Three

works:

  1. Item One

  2. Item Two, for example:

    private bool Test()
    {
        return this.IFeelLucky;
    }
    
  3. Item Three

Or indent 8 spaces instead of using backticks:

1. Item One
2. Item Two, for example:

        private bool Test()
        {
            return this.IFeelLucky;
        }

3. Item Three

Like this:

  1. Item One

  2. Item Two, for example:

     private bool Test()
     {
         return this.IFeelLucky;
     }
    
  3. Item Three

1. Item One
2. Item Two, for example:

   ```
   private bool Test()
   {
       return this.IFeelLucky;
   }
   ```

3. Item Three

works:

  1. Item One

  2. Item Two, for example:

    private bool Test()
    {
        return this.IFeelLucky;
    }
    
  3. Item Three

Or indent four more spaces beyond what's needed to indicate that the line is within the list item. In this example, that's 7 spaces: 3 spaces to line the start of the text up with the list item indent (here, the three characters of "2. "), plus 4 additional spaces to indicate the lines are code, for a total of 7 spaces:

1. Item One
2. Item Two, for example:

       private bool Test()
       {
           return this.IFeelLucky;
       }

3. Item Three

Like this:

  1. Item One

  2. Item Two, for example:

    private bool Test()
    {
        return this.IFeelLucky;
    }
    
  3. Item Three

Fix code block with backticks (missing newline) - reword second paragraph, as it otherwise does not make sense with the fixed markdown
Source Link
1. Item One
2. Item Two, for example:

    ```private```
    private bool Test()
    {
        return this.IFeelLucky;
    }
    ```

3. Item Three

works:

  1. Item One

  2. Item Two, for example:

    {
        return this.IFeelLucky;
    }
    
    private bool Test()
    {
        return this.IFeelLucky;
    }
    
  3. Item Three

Or indent again to have a prettier code block8 spaces instead of using backticks:

1. Item One
2. Item Two, for example:

        private bool Test()
        {
            return this.IFeelLucky;
        }

3. Item Three

Like this:

  1. Item One

  2. Item Two, for example:

     private bool Test()
     {
         return this.IFeelLucky;
     }
    
  3. Item Three

1. Item One
2. Item Two, for example:

    ```private bool Test()
    {
        return this.IFeelLucky;
    }
    ```

3. Item Three

works:

  1. Item One

  2. Item Two, for example:

    {
        return this.IFeelLucky;
    }
    
  3. Item Three

Or indent again to have a prettier code block:

1. Item One
2. Item Two, for example:

        private bool Test()
        {
            return this.IFeelLucky;
        }

3. Item Three

Like this:

  1. Item One

  2. Item Two, for example:

     private bool Test()
     {
         return this.IFeelLucky;
     }
    
  3. Item Three

1. Item One
2. Item Two, for example:

    ```
    private bool Test()
    {
        return this.IFeelLucky;
    }
    ```

3. Item Three

works:

  1. Item One

  2. Item Two, for example:

    private bool Test()
    {
        return this.IFeelLucky;
    }
    
  3. Item Three

Or indent 8 spaces instead of using backticks:

1. Item One
2. Item Two, for example:

        private bool Test()
        {
            return this.IFeelLucky;
        }

3. Item Three

Like this:

  1. Item One

  2. Item Two, for example:

     private bool Test()
     {
         return this.IFeelLucky;
     }
    
  3. Item Three

added additional indent example
Source Link
1. Item One
2. Item Two, for example:

    ```private bool Test()
    {
        return this.IFeelLucky;
    }
    ```

3. Item Three

works:

  1. Item One

  2. Item Two, for example:

    {
        return this.IFeelLucky;
    }
    
  3. Item Three

Or indent again to have a prettier code block:

1. Item One
2. Item Two, for example:

        private bool Test()
        {
            return this.IFeelLucky;
        }

3. Item Three

Like this:

  1. Item One

  2. Item Two, for example:

     private bool Test()
     {
         return this.IFeelLucky;
     }
    
  3. Item Three

1. Item One
2. Item Two, for example:

    ```private bool Test()
    {
        return this.IFeelLucky;
    }
    ```

3. Item Three

works:

  1. Item One

  2. Item Two, for example:

    {
        return this.IFeelLucky;
    }
    
  3. Item Three

1. Item One
2. Item Two, for example:

    ```private bool Test()
    {
        return this.IFeelLucky;
    }
    ```

3. Item Three

works:

  1. Item One

  2. Item Two, for example:

    {
        return this.IFeelLucky;
    }
    
  3. Item Three

Or indent again to have a prettier code block:

1. Item One
2. Item Two, for example:

        private bool Test()
        {
            return this.IFeelLucky;
        }

3. Item Three

Like this:

  1. Item One

  2. Item Two, for example:

     private bool Test()
     {
         return this.IFeelLucky;
     }
    
  3. Item Three

Source Link
Loading
Post Made Community Wiki by Cees Timmerman