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

Related (but not the same issue): Markdown formatting bug with code blocks in lists

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

The formatting guide says that you should indent code 4 spaces. However in this answer this is not working correctly. The problem seems to be when code directly follows, but is not part of a bulleted list.

I have replicated the bug below. Inserting a character between the end of the bullet and the code will cause it to appear correctly. See the second section for an example.

This seems to occur in both the preview and the posting.


  • List

    with new Importer .import "foo" .import "bar/baz" end with


  • List

Text

with new Importer
    .import "foo"
    .import "bar/baz"
end with
share|improve this question
    
    
@Jeff Atwood Isn't this what the status-bydesign tag is for? –  C. Ross May 27 '10 at 12:09
    
add comment

1 Answer

up vote 8 down vote accepted

In a list, you need to indent the code by 8 spaces rather than 4.

After a list, if you really don't want to have text before some more code, you can use something like   to fake it:

  • List item

    Code within item
    
  • Next item

 

Code after the list

In general though, I'd suggest including some text to introduce the code after the list anyway, which works round the problem.

share|improve this answer
1  
It is documented for (ordered) lists, in item 4 in "Advanced lists: Nesting". –  KennyTM May 26 '10 at 22:45
    
@KennyTM: Ah, yes. Will edit... –  Jon Skeet May 27 '10 at 5:30
    
@Jon It's not supposed to be in the list, it's supposed to be after the list. –  C. Ross May 27 '10 at 12:07
    
@C. Ross: Ah. The title confused me, and I see that was Jeff's edit. I suggest you edit the question to be somewhat clearer. –  Jon Skeet May 27 '10 at 12:33
    
It's not "simply" eight spaces. It's 4 spaces plus 4 per indentation level :) (for when you nest lists) –  badp Jul 25 '10 at 18:55
2  
An HTML comment would actually be cleaner than using a dummy string like &nbsp. It counts as real enough to constitute content for separating the list from the code, but since it is a comment it is skipped so you don't end up with a huge gap between the two. –  Grace Note Jul 25 '10 at 19:41
add comment

You must log in to answer this question.

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