Meta Stack Exchange is where users like you discuss bugs, features, and support issues that affect the software powering all 157 Stack Exchange communities.

What is meta?
Here's how it works:
  1. Any Stack Exchange user can ask a question
  2. The community provides support, votes on ideas, and reports bugs
  3. Your voice helps shape the way Stack Exchange operates

I found that " code sample " sometimes doesn't work as I want it to. See my question:

I tried to edit & correct code format But I wasn't able to format it.
The code was directly copied from Xcode. Yet not formatted properly.


  • could you please show me the way to format my code properly?
  • or, similar to the way image insertion has different screen, Stack Overflow should have some different mechanism to enter code only. (I am just suggesting for the feature.)
share|improve this question
up vote 4 down vote accepted

To be recognized as code, each line of it has to be indented by 4 spaces. You can achieve this either by inserting the spaces by hand, or by selecting the code block and clicking the "101010" button of the editor (keyboard shortcut is Ctrl-K).

I have done exactly that (Ctrl-K) with your question.

share|improve this answer
What is the short cut of mac keyboard? – Sagar R. Kothari Aug 29 '09 at 18:45
@sugar - CMD-K – Kevin Vermeer Aug 16 '11 at 22:04

I think it already got fixed. The problem with the original version is all code lines must be indented (4 spaces), and must be separated by at least one line from non-code.

Like so

So to illustrate pretending I'm in the editor...

this is my regular text

    this is my code
    and more code

but not ("must be separated by at least one line from non-code")

this is my regular text
    this is my code
    and more code

or ("all code lines must be indented")

this is my regular text

    this is my code
and more code
share|improve this answer
The original code was indented and separated fine; however it was indented with tabs instead of spaces. – balpha Aug 29 '09 at 19:19

You must log in to answer this question.

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