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

Possible Duplicate:
How do I format my code blocks?

What is a quick way to format many lines of code for Stack Overflow?

I insert all 4xNLines spaces each time one by one, and wondering that there should be quicker way to do this, but can't find it in FAQ as well as on meta.

P.S Found one question about shift+enter, but it doesn't work for me. I'm using MacOS10.7, and Opera 12.

share|improve this question

marked as duplicate by Martijn Pieters, jonsca, Anna Lear Aug 20 '12 at 4:57

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

add comment

1 Answer 1

up vote 3 down vote accepted

See the two {} in the editor toolbar, right above the big textarea where you type your question/answer? Highlight the code, and click that {} in the toolbar. This will format your code very quickly:

function test() {
    alert("hello world");
}

Pressing {} on the above code automatically put it inside a code block.

share|improve this answer
8  
Or alternatively, select all and hit ctrl+k –  Bart Aug 19 '12 at 20:49
    
jmort253, Thanks! (I will accept your answer in 10 minutes:) ) Bart, thanks too. –  klm123 Aug 19 '12 at 20:51
1  
that alternative comment have more votes than your answer o_o –  ajax333221 Aug 19 '12 at 23:17
    
@ajax I simply leave brilliant comments.... :) –  Bart Aug 21 '12 at 17:15
    
@Bart oh, I thought it was from jmort, my "your answer" is incorrect –  ajax333221 Aug 21 '12 at 17:28
add comment

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