4

I know the syntax highlighting for code blocks is disabled on superuser. Do we want it disabled here as well?

It seems to me that the large majority of the time a code block is used is for log fragments or configuration fragments. Most of the time it seems like the syntax highlighter doesn't seem to handle these blocks of text and just makes things look ugly with all the various colours.

4
  • 2
    I can't recall seeing (or at least not noticing) any syntax highlighted posts. Can you give us a link to one please? Oct 14, 2010 at 2:46
  • @John Gardeniers, Look at the code blocks in these questions. Notice that the font color changes. serverfault.com/questions/18744 (check the apache.conf see how it is all wonky) serverfault.com/questions/155115 serverfault.com/questions/189165
    – Zoredache
    Oct 15, 2010 at 23:33
  • thanks for those examples. I see your point and agree that it looks pretty crappy. Oct 18, 2010 at 0:02
  • Thanks also for those examples. Most of the syntax highlighting is so subtle that it makes it feel like my LCD is flaking out or my eyes are tired... Yes, I stand by my answer below; if you want syntax highlighting, copy it into your own editor!
    – gWaldo
    Oct 20, 2010 at 13:01

6 Answers 6

4

After seeing some examples I'd like to syntax highlighting turned off by default and if a poster wants it on they should be asked to specify what language the code block is on. Although highlighting might work well on SO, from what I can see the language detection is a long way from perfect for the stuff being posted on SF.

4

Shell scripting plays a big part in Unix system administration, and it would be nice if syntax highlighting was enabled for this sort of code block.

An personally, I like the idea of syntax highlighting for log fragments, or Apache Configuration fragments, etc, as long as the highlighting works correctly. Although the syntax highlighter doesn't always work correctly.

It would be nice if we could provide hints to the syntax highlighter, as proposed at syntax-highlighting-language-hints.

2
  • The problem is that is it doesn't seem to work right in some cases. See serverfault.com/questions/18744. In the apache.conf scroll down to the worker mpm section.
    – Zoredache
    Oct 15, 2010 at 23:40
  • I would strongly prefer the default to be no highlight with an option to enable it. I agree it is useful in many cases.
    – Zoredache
    Oct 15, 2010 at 23:42
4

You can always use <pre> tags to get the code style without the actual syntax highlighting if you want. Although perhaps that should be the default for SF.

There should be 
no syntax highlighting here
even of things like printf("%i\n")
1
  • +1 - this is what I do when I don't want highlight and I sometimes go and retro-fit it to other posts, however the majority of users wouldn't know about this. Mar 7, 2011 at 20:37
1

It might be useful to some people, but only if the highlighting follows some standard - is there one?

For those it would not be useful for, would there be a problem? Is there an increased performance hit compared to the existing parsing?

1
1

My vote is to keep it simple by keeping Syntax Highlighting off. If you want it, you can always copy/paste into your text editor of choice, using your preferred color scheme. (Everybody else's colors are stupid... To everybody else)

1

It appears this can now be addresses by manually specifying the language.

You must log in to answer this question.

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