GitHub - yihui/highr: Syntax Highlighting for R Source Code (original) (raw)
highr
This is an infrastructure R package for syntax highlighting. It supports LaTeX and HTML output. Not surprisingly, it works best with R code. It attaches markups onto source code, e.g., it turns
into LaTeX code
\hldef{a} \hlkwb{<-} \hlnum{1} \hlcom{# something}
or HTML code
a <- 1 # something
via
library(highr) hi_latex("a <- 1 # something") hi_html("a <- 1 # something")
or hilight(code, format = "latex"/"html")
This package also has a wrapper function, hi_andre()
, for Andre Simon'sHighlight package.
There are a few package Markdown vignettes in this package:
browseVignettes(package = "highr")
To install the development version here, use
install.packages('highr', repos = 'https://yihui.r-universe.dev')
This package is licensed under GPL, and was originally designed for serving other packages such as knitr.