-5

Possible Duplicate:
How to nest code within a list using Markdown
Markdown formatting bug with code blocks in lists

In this answer the first line of code in the question is being displayed properly. The background of the other code sections are different from the background of the first code block.


enter image description here

2
  • I've seen this problem when you try to post code in a list or just after a list (as you're doing). Commented Jan 27, 2013 at 3:30
  • 1
    its not bug ,its because of list Commented Jan 27, 2013 at 4:07

1 Answer 1

4
  • Inside a list context, you need to indent code by eight spaces

      foo += bar
    

    and start subsequent lines with a space to keep them indented.

  • If you want to have a code block right after your bullet point indented as if it wasn't in the bullet list, use a comment <!-- -->.

foo -= bar
2
  • Thanks :) But isn't point 2 a workaround ? It still is a bug.
    – asheeshr
    Commented Jan 27, 2013 at 7:32
  • 4
    I don't think it is. Since lines starting with one space are considered to be inside the list/bullet item. The four-space indent isn't enough for a code block inside the list, but it also is enough for the paragraph to be considered inside the list. You can't break that without something that's not indented at all, the parser can't tell the difference.
    – Mat
    Commented Jan 27, 2013 at 7:36

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