1

This question already has an answer here:

I want to add Code sample under Numbered List but unfortunately I am not able to do so.

Here is an example of what I want to achieve:
Using Numbered List -

  1. This is my first point
  2. I want to add my code sample under this point

    public class HelloWorld {
    public static void main(String[] args) {
    System.out.println("Hello, World");
    }
    }

  3. My Third point.

Without using Numbered List -

i. This is my first point
ii. I want to add my code sample under this point

public class HelloWorld {  
    public static void main(String[] args) {  
        System.out.println("Hello, World");  
    }  
}  

iii. My Third point.

I want my code sample should look like this. (Similar to the one Without using Numbered List)
How can I achieve this using Numbered List?

marked as duplicate by random, Billy Mailman, Shadow The Curly Braced Wizard, nicael, Mat May 13 '15 at 14:04

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1

Simply indent by 8 spaces1, like below:

  1. This is my first point
  2. I want to add my code sample under this point

    public class HelloWorld {  
      public static void main(String[] args) {  
        System.out.println("Hello, World");  
      }  
    }  
    
  3. My Third point.

Here's the Markdown:

1. This is my first point
2. I want to add my code sample under this point

        public class HelloWorld {  
          public static void main(String[] args) {  
            System.out.println("Hello, World");  
          }  
        }  
3. My Third point.

1 Or, if already indented, an extra 4 spaces.

Not the answer you're looking for? Browse other questions tagged .