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

I'm already trying with the tag pre but doesn't working


public static bool testFunction()
  //some commented code
  return true;

The "return true" and other keywords must be blue

share|improve this question

migrated from Aug 21 '10 at 0:08

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

Are you asking about formatting your question posts on StackOverflow? If so, check out the meta site (, where questions about the site (and posting on it) are addressed. – JYelton Aug 20 '10 at 20:57
Don't use <pre>. Add 4 spaces before code. – Oded Aug 20 '10 at 20:58
i thought he was asking about SO, but the question itself doesn't have pre in it, and the tag is html. maybe it's just poorly worded? – Claudiu Aug 20 '10 at 20:59
what's SO? I'm gonna try with 4 spaces before the code public static bool test() { return true; } – Anonymous Aug 20 '10 at 21:17
4 spaces before the code do nothing i'm gonna try with "code" tag <code> return false; </code> – Anonymous Aug 20 '10 at 21:18
Work perfectly with 4 spaces before the code but not in a comment. Only in the post of the answers – Anonymous Aug 20 '10 at 21:25
This seems to belong on meta... – Ryley Aug 20 '10 at 21:58
yea this dont belong – Claudiu Aug 20 '10 at 23:56

Since the changes to syntax highlighting in December 2010, the highlighting is based on the tags on the question. Hence examples of code blocks in this very question will not show any highlighting unless some fake language tag like java or html is added to the question. (They will show preformatted text using a monotype font though; just not coloured.)

share|improve this answer

Dude just read the full reference on how to format your text.

share|improve this answer
I don't know what's happened but now I'm watching my first post with the blue keywords that is correct... I'm using the pre tag with de property lang="cs" cause is c# code let me try again <pre lang="cs" > private void test() { test2.add(); } </pre> – Anonymous Aug 20 '10 at 21:11
<pre> public static bool test() { return true; //some commented code } </pre> – Anonymous Aug 20 '10 at 21:13
someone edited your post to correct the formatting. – Claudiu Aug 20 '10 at 23:57

Testing now with 4 spaces before the code

return false;

public static void testFunction()
share|improve this answer

4 spaces before the code works great here in Stack Overflow, but in other sites will work too?

share|improve this answer
If they use Markdown, yes. If they don't, who knows? (Name a specific site and it becomes possible to answer.) – Donal Fellows Aug 20 '10 at 21:36
@Donal, the syntax highlighting is not a Markdown feature, but is using client side Google Code Prettify. – Arjan Jan 15 '11 at 23:22

You must log in to answer this question.