Rainbow is a lightweight syntax highlighter implemented in JavaScript.

I have added support for the R language and ported the pastie theme (with a few minor differences) from Pygments to Rainbow. These changes have been incorporated by Craig Campbell in the Rainbow GitHub repository.

Due to the limitations of JavaScript’s implementation of regular expressions, highlighting R output (like you would see in an R session, with prompts) is more challenging and thus was not attempted.

Try highlighting some R code for yourself! Enter code into the text area below, and momentarily the highlighted code will appear below.