Possible Duplicate:
Why is a code block not properly formatted when placed immediately after a list item?

The 4 space indent is not being recognized as a code block after a numbered list.

See below for example:

  1. Make waffle batter
  2. Cook for 6 to 8 weeks
  3. Feed to unicorn

    public void EatWaffles(Unicorn unicorn) { if (unicorn.LikesWaffles) { // do something } }

First saw the problem on this SO answer. I forced the code highlighting on that answer using <pre><code>...</code></pre>, but I think this is probably a problem that should be fixed.

  • You might want to switch the order of those ending tags. Generally it would be </code></pre> Apr 21 '10 at 2:44
  • @Chacha102: Oops! Since I had to add the &lt; and &gt; to make the tags show, I copied and pasted it but forgot to reverse the order. Thanks! Apr 21 '10 at 3:36

Indent your code eight spaces instead of four.

  • I
  • Am
  • a
  • List!

    public class OhLookImAfterAList
        public OhLookImAfterAList()
            Console.WriteLine("Oh Snap!");
  • Hmmm...I wonder if the code formatting button should be modified to add the 8 spaces if the block is just after a list. Apr 21 '10 at 3:40

You need to put 8 spaces for that.

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