I have posted three times in SQA so far, and have really missed the Syntax Highlighting of StackOverflow for code. Is this really not possible?
3 Answers
Ok, this is available on the site now. I've turned it on (auto-detecting the language) for python, java, and selenium - moderators can enable it as-needed elsewhere. Any author or editor can enable it for any given code block as ChrisF describes
It should be possible.
There's can be combo box on the Tag Wiki page (visible only to moderators) that allows you to indicate which syntax highlighting rules should be used for code in that tag.
You can also use the hints defined in this Meta Stack Overflow answer:
<!-- language: lang-or-tag-here -->
code goes here
If this doesn't work or the "Code Language" drop down isn't there then your moderators need to request that the feature is enabled.
-
+1 Thanks. I didn't thought that it would be as easy as posting an email. The Stackoverflow team has activated it now :-)– AlbertoNov 22, 2011 at 23:03
Paste your code block, then highlight your code block, then click the "{ }" button in the Text Editor toolbar. Most code blocks will syntax highlight, but not sure about all.
-
The "{}" button only indents the block 4 spaces to the right. It'll be recognized as code, but I have tested java and C++ code fragments, and they aren't colored -- just rendered in a gray box. In StackOverflow, there is even the option to explicit declare the language a block is written in. Do you have a link to a message with color-highlighted code?– AlbertoJul 28, 2011 at 21:53
-
-
:-) That's exactly the point. The message you link is in StackOverflow, not in "Software Quality Assurance & Testing."– AlbertoJul 28, 2011 at 22:02
-
Oh, okay. Are you pasting code in meta.stackexchange.com sqa.stackexchange.com? Jul 28, 2011 at 22:04
-