Meta Stack Exchange is where users like you discuss bugs, features, and support issues that affect the software powering all 158 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

Possible Duplicate:
How do I format my code blocks?

This is my very first post on SO and I have a quick question... In order to post a code block it says to indent by four spaces. Does this mean I have to indent every line of code 4 spaces? I feel like I'm missing something here. What's the best way to just copy and paste some code (java and xml) into a post and have it blocked and formatted (without having to edit each and every line I've pasted)???

share|improve this question

migrated from May 9 '12 at 17:41

This question came from our site for professional and enthusiast programmers.

marked as duplicate by a cat, Kevin Vermeer, kiamlaluno, Andrew Barber, Al E. May 9 '12 at 18:09

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.

Select the code and click the {} button. See How do I format my code blocks?. – Felix May 9 '12 at 17:41
Why do so many people have trouble with this? What can we do to make the bouncing formatting help more noticeable? <blink>? – Cody Gray May 9 '12 at 19:24
@TheEstablishment: Apparently we need Clippycorn back. – Felix May 9 '12 at 21:43
@TheEstablishment, for me personally it's not clear that I must first paste a code block and only then press the tool button. When you do in such order, the code becomes messed up just after pasting and this is confusing, and prevents people from continuation. When you do other way - press the button first and then paste - only first line of code becomes formatted properly and all the others must be idented manually. This can be improved, imho, that is SO should format all new text entered into empty idented position if it's just created by pressing the button. May be feature request? – Stan Nov 7 '12 at 21:45
up vote 2 down vote accepted

Paste the code into the text area then highlight the code and click on the Code Sample {} button.

See How do I format my code blocks?

share|improve this answer

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