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?

| |
  • Wow, I hadn't noticed, but now that you mention it, that would be very nice! – corsiKa Jul 27 '11 at 17:11

Ok, this is available on the site now. I've turned it on (auto-detecting the language) for , , and - 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 :-) – Alberto Nov 22 '11 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? – Alberto Jul 28 '11 at 21:53
  • :-) That's exactly the point. The message you link is in StackOverflow, not in "Software Quality Assurance & Testing." – Alberto Jul 28 '11 at 22:02
  • Oh, okay. Are you pasting code in meta.stackexchange.com sqa.stackexchange.com? – MacGyver Jul 28 '11 at 22:04
  • I have pasted code in sqa. – Alberto Jul 28 '11 at 22:09

You must log in to answer this question.

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