Meta Stack Exchange is where users like you discuss bugs, features, and support issues that affect the software powering all 158 Stack Exchange communities.

What is meta?
Here's how it works:
  1. Any Stack Exchange user can ask a question
  2. The community provides support, votes on ideas, and reports bugs
  3. Your voice helps shape the way Stack Exchange operates

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?

share|improve this question
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 '11 at 2:17
up vote 26 down vote accepted

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
share|improve this answer
this does not seem to be working for me for "none" see… – Ian Ringrose Mar 7 '11 at 12:52
cs or csh is c#? – TDaver Mar 7 '11 at 13:00
@TDaver: I believe it is cs. csh would be the shell I would think. – Jeff Mercado Mar 8 '11 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 '11 at 8:23
@JeffAtwood: I tried <!-- language: lang-sh --> here, but it didn't work. – sjngm Mar 16 '11 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 '11 at 10:18
@sjngm did you put one blank line between the <!-- language ... --> and the code block itself? – Shadow Wizard Mar 22 '11 at 12:20
@ShadowWizard: I had it without one and just tried with one, but it only colours the numbers differently. – sjngm Mar 23 '11 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:… – Shadow Wizard Mar 23 '11 at 9:10
@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 '11 at 14:33
@jach do it at – Jeff Atwood Mar 23 '11 at 22:39

You must log in to answer this question.

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