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

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

example:

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

The "return true" and other keywords must be blue

share|improve this question

migrated from stackoverflow.com Aug 21 '10 at 0:08

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

3  
Are you asking about formatting your question posts on StackOverflow? If so, check out the meta site (meta.stackoverflow.com), 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
add comment

4 Answers

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
add comment

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
add comment

Testing now with 4 spaces before the code

return false;

public static void testFunction()
{
}
share|improve this answer
add comment

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
add comment

You must log in to answer this question.