Sometimes, it can be useful to quote a different language to the one used in the question. For example, one might be interested in the C source code of a language interpreter in order to understand how it works and to find an answer to ones original question.

See This answer as an example.

An override syntax has been proposed. When will it be implemented? Will it fit this use case?

  • Keep in mind that this only works on sites for which it has been enabled. If it's not active on your site, ask for it on your meta.
    – jcolebrand
    Sep 29, 2011 at 2:17

1 Answer 1


This is now implemented. In addition to tag inference (a recent change), you can manually specify the language as a hint to Google Code Prettify.

The spec is:

<!-- language: lang-or-tag-here -->

    code goes here

<!-- language: lang-or-tag-here -->

    code goes here

You may use either a tag or a prettify language code to specify, though prettify language codes are always guaranteed to work regardless of what language the tag happens to be set to.

The complete list of supported prettify code languages is:

  • lang-none
  • lang-default
  • lang-bsh
  • lang-c
  • lang-cpp
  • lang-cs
  • lang-csh
  • lang-css
  • lang-hs
  • lang-html
  • lang-java
  • lang-js
  • lang-lisp
  • lang-lua
  • lang-ml
  • lang-perl
  • lang-php
  • lang-proto
  • lang-py
  • lang-rb
  • lang-scala
  • lang-sh
  • lang-sql
  • lang-vb
  • lang-xml
  • 1
    this does not seem to be working for me for "none" see stackoverflow.com/questions/5187607/… Mar 7, 2011 at 12:52
  • cs or csh is c#?
    – TDaver
    Mar 7, 2011 at 13:00
  • 1
    @TDaver: I believe it is cs. csh would be the shell I would think. Mar 8, 2011 at 1:18
  • @JeffAtwood: could you please add one for Java's property files? lang-sh seemed appropriate but doesn't do anything. It should highlight the "=" and use a different colour for "#"-comments.
    – sjngm
    Mar 16, 2011 at 8:23
  • @JeffAtwood: I tried <!-- language: lang-sh --> here, but it didn't work.
    – sjngm
    Mar 16, 2011 at 8:27
  • +1 for the language none! Comes in handy.. when you don't want highlighted stuff to be color coded!
    – gideon
    Mar 20, 2011 at 10:18
  • @sjngm did you put one blank line between the <!-- language ... --> and the code block itself? Mar 22, 2011 at 12:20
  • @ShadowWizard: I had it without one and just tried with one, but it only colours the numbers differently.
    – sjngm
    Mar 23, 2011 at 8:16
  • @sjngm that's right... but it's not in our hands, that's how the external tool is coloring that language. You can mess around with this in the sandbox: meta.stackexchange.com/questions/3122/formatting-sandbox/… Mar 23, 2011 at 9:10
  • 3
    @Jeff what's the best way to contribute a new language to that list? I'm mainly interested in pascal like syntax highlighting, and I'm willing to make the contribution myself.
    – jachguate
    Mar 23, 2011 at 14:33
  • 1
    @jach do it at code.google.com/p/google-code-prettify Mar 23, 2011 at 22:39

You must log in to answer this question.

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