3

This is the question I'm referring to: the answer I provided contains some valid C code.
It is intended with 8 space chars.
The code is not colored as it does usually (at least on stackoverflow).

Did something change - or SF does not provide coloring like SO does?

1

3 Answers 3

10

If the question had been tagged , your code block would have worked. But, it wasn't.

You could add the tag, I suppose... But that seems lame, since the question wasn't about C.

So your next best option is to simply force syntax highlighting for your code block, by prefixing it with a special comment:

<!-- language: lang-c -->

    ... code goes here, indented by four spaces as usual ...

I've done this for you. Enjoy!

1
  • Thanks... The desperately unexpected answer!
    – Déjà vu
    Aug 14, 2011 at 4:47
2

We turned off code-coloring because text enclosed in code brackets here is so very rarely something SO has a dissector for. Things like umpty lines of syslog entries, random java stack-dumps in application-specific log-files, or RFC quotations don't react well to syntax-coloring for most programming languages. We have a few tags where they're turned on, is one such I believe, but in general we don't syntax-color here.

3
  • That sounds like a wise decision. But you should have a way to force color highlighting. (e.g. using the <code> tag - that I tried also)
    – Déjà vu
    Aug 14, 2011 at 3:19
  • I was going to say that you could, but I just tried a test post here on meta and it doesn't seem to permit you even if you explicitly request it.
    – Zoredache
    Aug 14, 2011 at 3:46
  • 1
    @Zoredache: meta doesn't have any syntax highlighting enabled. The main site does. Your test would have worked on the main site...
    – Shog9
    Aug 14, 2011 at 4:24
1

Syntax highlighting of programming languages really doesn't make a whole lot of sense on a non-programming site. SF is not SO, so don't expect things to work identically.

You must log in to answer this question.

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