What is meta? ×
Meta Stack Exchange is where users like you discuss bugs, features, and support issues that affect the software powering all 130 Stack Exchange communities.

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!");
}
share|improve this question

marked as duplicate by balpha Nov 7 '11 at 7:48

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.

    
See my explanation in meta.stackexchange.com/questions/3327/… –  balpha Nov 7 '11 at 7:48

3 Answers 3

up vote 5 down vote accepted
  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();
}
share|improve this answer

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.

share|improve this answer

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.

share|improve this answer

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