Meta Stack Exchange is where users like you discuss bugs, features, and support issues that affect the software powering all 158 Stack Exchange communities.

What is meta?
Here's how it works:
  1. Any Stack Exchange user can ask a question
  2. The community provides support, votes on ideas, and reports bugs
  3. Your voice helps shape the way Stack Exchange operates

In my answer I can't get code formatting to work. What do I do wrong?

Ok, I understand it was still in the list. However, I used two linebreaks between my last listitem and the code. How much linebreaks should I use then?

share|improve this question
Extra four spaces:… – random Feb 8 '10 at 9:20
up vote 1 down vote accepted

See here

I recommend avoiding code inside lists, personally, but you need to indent 8 spaces.

share|improve this answer
Another note on this... Once you have a list in your answer, if you want to insert code that is not at the list level, you must have at least one non-blank, non-list line before the code (a horizontal rule works well) in order to break out of the "list" logic and allow the code to be formatted correctly. (See o.k.w's answer below, and… for an example that I just edited.) – GalacticCowboy Jun 29 '10 at 15:05

A list:

  • item 1
  • item 2

    function(code-in-a-list){ //with four leading spaces }

The Code: (this line ends the list too)

  //with four leading spaces too
share|improve this answer

You must log in to answer this question.

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