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

I asked a question on StackOverflow recently and had trouble with the MarkDown processor: the code block would not render as code despite being indented four spaces. I've not had this trouble before; maybe the StackOverflow devs have been tinkering and have broken something? It seems to be connected with the fact that the code block is preceded by a list.

In the end, I had to use a <pre> tag, but this doesn't provide colouring, so it's not as nice.

I'd be grateful for feedback from the community, and if that doesn't help, I'd be glad if someone from the SO team could take a look to see what's going wrong.

Many thanks.

share|improve this question
    
I know it's not really 'completed', because the problem still exists for other posts. However, the larger issue is tracked in another item (no link handy at the moment) so I'm marking it completed in the sense that your particular post is completed. –  Joel Coehoorn Sep 29 '09 at 13:53
    
@Joel: has this been fixed since then? I was having trouble with modifying stackoverflow.com/questions/1985094/… –  Andrew Grimm Mar 8 '11 at 5:57
    
@JoelCoehoorn Can you post the link here? thanks. –  rwong Aug 25 '12 at 5:29

2 Answers 2

up vote 6 down vote accepted

For some reason having the code immediately follow the unordered list was causing a problem. By inserting an innocuous line of text between the end of the list and the code ("Here's the code:"), the code formatting worked as intended.

share|improve this answer
    
Thanks for diving in and sorting it out for me :) Am I right in thinking that the problem wasn't with my markup but with SO's MarkDown formatter, or is there something special in MarkDown about needing to have non-whitespace text between the end of a list and the start of a code block? –  sampablokuper Sep 29 '09 at 12:41
    
@sampablokuper: Yes, it wasn't your fault, although I'm not sure whether the problem is with SO's particular MD implementation or with the original MD as they adopted it. –  ベレアー アダム Sep 29 '09 at 12:45
1  
What I do, which is similar, is add a blank line, then a comment like <!-- end the list --> and then another blank line. This tells the MD parser that the list is over and allows me to have a normal code block follow. The formatted output does not show the blank lines, so it's slightly better than forcing yourself to write some text. –  hatboysam Nov 6 '13 at 16:19

I had this problem before. See the linked thread for solutions. Basically, you need to indent by eight spaces (four for the list, four for the code), or insert some invisible text, such as a space between backticks.

share|improve this answer
    
+1 nice workaround, thx –  quack quixote Oct 25 '09 at 16:20
2  
This is the correct answer. It's not a workaround but the (poorly documented) right way. –  Mauvis Ledford Apr 23 '12 at 5:26

You must log in to answer this question.

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