1

Possible Duplicate:
Code block is not properly formatted when placed immediately after a list item

The title says it all. Here is a reproduction:

  1. An Item
  2. A second item

    // Note that there are four lines of whitespace between the setence and this code public void main() { printf("Hello World!"); }

Now that same code under a regular paragraph:

public void main() {
    printf("Hello World!");
}
1

3 Answers 3

5
  1. If you want the code to be indented, do it like this:

    // four more spaces
    public void main() {
      printf("Hello World!");
    }
    
  2. If it's outside the list, then like that:

void foo() {
  bar();
}
4

You simply need extra more four spaces:

  1. An Item
  2. A second item

    // Note that there are four lines of whitespace between the setence and this code
    public void main() {
        printf("Hello World!");
    }
    

Not sure what's the reason, but it's been like that always.

3

That's not a bug. A 4-space intend after a numbered list is used to have multi-paragraph numbered items. For example:

  1. My first item.

  2. My second item.

    A bit more about my second item.

  3. My third item.

You can always use explicit HTML-style markup to start a code block. Or you can put a comment between the last item and the code block.

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