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.

it happened to me few times lately that after submitting new question the formatting of inserted code was corrupted. I am 100% sure that it looked ok at the time I clicked Post Your Question button.

I did copy&paste from my text editor (I use tabs to indent the code) into SO question box and then I was fixing the formatting.

I do not have any screen shots but you can probably go through all the versions of this question where I was reminded via comment to fix the formatting.

share|improve this question

2 Answers 2

up vote 3 down vote accepted

Markdown interprets lines indented by four spaces as code blocks. Tabs are pretty much ignored and will make your code look sloppy. And you don't want that.

Before you cut and paste your code from your favourite text editor, swap out all the tabs for four (4) spaces.

Then you can drop it in and the code will look good too.

share|improve this answer
3  
This is all part of the excellent plan to stop people coding with tabs ;-) –  bobince Jan 24 '10 at 13:42
2  
the MarkdownSharp will correctly normalize tabs to spaces in most (all?) cases now –  Jeff Atwood Jan 24 '10 at 14:39

In that specific case, you had some lines with only three spaces at the start. A code block must retain at least four spaces at the start of each line.

share|improve this answer
    
@bobince: I am sure that the code look ok before I sent it out. What was saved is different story –  Radek Jan 24 '10 at 18:36

You must log in to answer this question.

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