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

Possible Duplicate:
How do I format my code blocks?

I did the following: I wrote my question, paste my code, then click {} from the format toolbar. My code turns to grey-colored, but is not colored as I saw in some other posts (keywords are colored) also I can't insert spaces once I use {}. how can I format my code in my posts ?

share|improve this question

marked as duplicate by Yannis, DMA57361, Shadow Wizard, Mat, Daniel Fischer Jun 26 '12 at 11:49

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.

1  
You will get the proper colors once you add the correct language tag to the question. –  Bo Persson Jun 26 '12 at 9:16
2  
@BoPersson: there is a delay even if the correct tags are present. Only if you do not make changes and wait a moment does the syntax highlighting kick in. –  Martijn Pieters Jun 26 '12 at 9:22
    
This delay is almost 5 seconds. –  Jean-Rémy Revy Jun 26 '12 at 9:23
    
possible duplicate of How do I format my code blocks? - flagged ( hehe in the same time Yanis ;) ) –  Jean-Rémy Revy Jun 26 '12 at 9:23
    
@Bo Persson: that is it. –  Jury A Jun 26 '12 at 9:26
    
If you'd probably tag your questions (with e.g. java), the syntax highlighting would work. –  Time Traveling Bobby Jun 26 '12 at 9:27

1 Answer 1

Wait a moment. When editing your question or answer, the syntax highlighting is disabled temporarily. If you stop editing, after a timeout the highlighting will kick in and the colours will appear. The delay is around 5 seconds, I believe.

This does depend on the tags present on the question, or you can add hints in the markdown source of your post.

To add hints, simply add a <!-- language: ... --> comment on a line of it's own (not indented) before the code block. If you use language-all instead, the choice is applied to all code blocks in your post. See the site help text on this feature.

share|improve this answer

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