I spend a bit of time some days editing and improving the quality of questions and answers, and confortably the most common task is to format a block of code where the questioner/answerer has failed to do so.
Moreover, it's clear that many new users just don't understand how to do so. Check out the comments on the following question
https://stackoverflow.com/q/6124080/144491
The problem of getting people to format code correctly in their posts seems to be endemic. For me there are a number of issues:
- The posted code is incomprehensible.
- In the case of HTML tags the posted code can actually be hidden.
- Tabs are pasted as tabs, and spaces as spaces making formatting even more difficult.
I have a few thoughts regarding this:
- A warning message is displayed when you make a post that looks like it contains unformatted code (akin to the warning when the system deems you should start voting for answers).
- Convert all tabs to (4?) spaces when posting (client-side clipboard access issues make it difficult to do so on pasting).
- Add a new tab the the 'review' page to highlight potentially unformatted code.
- Add something to the FAQ with regard to code formatting.
Does anyone have any more, or thoughts of their own regarding this?