I know it is possible to use <!-- language: X --> to get different syntax highlighting in posts for at least some languages, X. For example, this works for LuaLaTeX.

It, however, does not seem to work for R on TeX.SX! I've tried both <!-- language: r --> and <!-- language: R -->. (See here.)

Is it possible to get syntax highlighting for R on TeX.SX?


1 Answer 1


R is listed as one of the supported list of languages; available as <!-- language: lang-r -->.

In general, new scripting languages won't be implemented by StackExchange directly. However, there is hope...

The following is taken verbatim from What is syntax highlighting and how does it work?:

How does it work?

Stack Exchange does not have its own syntax highlighting engine. It uses Google Code Prettify. Therefore, any bugs and feature requests regarding syntax highlighting cannot be handled by Stack Exchange and should be directed to the team behind Google Code Prettify.

Syntax highlighting is assigned to the preview when creating or editing posts as soon as you stop typing for 5 seconds.

Why isn't my code being highlighted correctly?

If your post doesn't have the correct highlighting, it's possible it's not supported. Please look at the list of supported languages. If your language is not on the list, it needs to be created within the Prettify project before it can be deployed by Stack Exchange. If a language that could be applied to a tag is already on the list, please raise a feature request here on Meta to have it deployed on the network.

How do I report a bug or request a new language?

If it is indeed a bug in the syntax highlighter itself, check the issues list to see if it has already been reported. If it hasn't, feel free to report it or join the project and submit a fix yourself. If you want to ensure that an issue you raised is fixed quickly, it's best to include the fix in the report. If the fix has already been implemented by Prettify but is still not working here, please raise a feature request on Meta to request that a new version of Prettify be deployed.

  • Errr, "R" is in the "supported list of languages" that you link to above - perhaps this is a recent addition?
    – Thruston
    Sep 7, 2014 at 15:46
  • @Thruston: True! I'll update the post to reflect that it is available.
    – Werner Mod
    Sep 8, 2014 at 2:26

You must log in to answer this question.

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