4

When putting some code sections into SO questions, the system tries to detect the language and automagically colorizes the code but sometimes if the excerpt of code is small enough it cannot get the correct language, or renders no language at all (grey text).

By looking at some edits from experienced SO users I have found the <!-- language: lang-xxx --> trick to give the correct language to the rendering engine.

That meta answer gives a list of supported languages but I have seen in SO some languages not listed here (like lang-nsis) and the source of code-prettify shows a list that is different of what is told here.

  1. Is there an up-to-date list of supported languages for syntax highlighting in Meta?
  2. Would it be possible to show it in the "markdown editing help" to keep it accessible easily?
3
3

The list you found is up to date. We don't use all of the files in that directory, (which is why it contains languages you can't use here, like lang-wiki), and not all languages have their own files (because some are built into prettify core, like lang-sh).

There is no NSIS highlighting on Stack Overflow. If you found <!-- language: lang-nsis --> somewhere, that comment is futile. It will just use the default highlighter, which may look reasonable, thus giving the impression that lang-nsis is actually a supported plugin (has anyone actually ever created one?).

1
  • 3
    Why don't you use all (or more) of the files in that directory? Is it purely a question of popularity? If so, I think that you ought to look into adding lang-vhdl to Electrical Engineering: Support VHDL syntax highlighting is our second-most upvoted feature request! May 22 '12 at 13:53

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