The purpose of this document is to demonstrate that an R Markdown document can display syntax highlighting for languages that are not supported natively by R Markdown. Highlighting is actually supported by pandoc and the skylighting Haskell library. A full list of languages supported by pandoc can be found here.

The original reason for working through this was to enable SAS syntax highlighting within an R Markdown html document.

For a full description of how this is accomplished and stitched together, refer to my blog post.

Requirements

The following R packages are required for the proposed solution.

In addition, one will need access to the internet as the solution makes use of <script> tags to read in Javascript libraries from a CDN.

Languages

SAS

Below is an example of highlighting SAS code. The code was taken from the CodeMirror example page.



Crystal

Below is an example of highlighting Crystal code. The code was taken from the CodeMirror example page.