There are some questions for which the syntax highlighting is not active because none of the tags used for the question have syntax highlighting enabled.

It is probably better to set PHP as default syntax highlighting mode, as in most of the questions, the shown code is PHP code; if the answer is showing code in a different programming language, it still possible to force the highlighter to use a different syntax mode, or set a different default highlighting mode for specific tags.

1 Answer 1


I suspect the better solution would be to set the default to auto-detect. It should work pretty well for PHP in this mode, and more importantly it won't completely wreck other languages (say, XML) that might commonly find their way into a question.

I'd argue that simply adding the [php] tag to such questions would be enough, but since the entire site is about Drupal (which sorta implies PHP), that just makes the [php] tag into a synonym for [drupal] (and therefore sorta useless).

  • I remember seeing "auto-detect" as option for the tag syntax highlighting, but I didn't think that could be also one of the options for the default syntax highlighting. If it work well with PHP, then it is a better option then explicitly setting the syntax highlighting to "lang-php." Probably most of the tags should be reset to "default" too; I set most of them to a specific syntax highlighting because the default is actually "none," and I didn't know how much trustable was "auto-detect."
    – apaderno Mod
    Nov 27, 2011 at 19:14
  • 2
    Autodetect actually works reasonably well for most C-like languages, XML, HTML, etc... Well enough that if you expect languages to be mixed you'll want the associated tags to all be set to autodetect. That's probably less important here than it is on, say, SO, but probably still worth doing for some of the more tangential tags (ajax would be a good candidate I suspect).
    – Shog9
    Nov 27, 2011 at 19:46
  • This is very useful information; thank you. If I knew it, I would have set the correct option; now there are probably some tags that would have their settings changed. :-)
    – apaderno Mod
    Nov 27, 2011 at 20:07

You must log in to answer this question.

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