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.


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.

| 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.

| 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 .