Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/yihui/highr

Syntax Highlighting for R Source Code
https://github.com/yihui/highr

html latex r r-package syntax-highlighting

Last synced: 13 days ago
JSON representation

Syntax Highlighting for R Source Code

Awesome Lists containing this project

README

        

# highr

[![R-CMD-check](https://github.com/yihui/highr/workflows/R-CMD-check/badge.svg)](https://github.com/yihui/highr/actions)
[![CRAN release](https://www.r-pkg.org/badges/version/highr)](https://cran.r-project.org/package=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

```r
a <- 1 # something
```

into LaTeX code

```latex
\hldef{a} \hlkwb{<-} \hlnum{1} \hlcom{\# something}
```

or HTML code

```html
a <- 1 # something
```

via

```r
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's
[Highlight](https://gitlab.com/saalen/highlight) package.

There are a few package Markdown vignettes in this package:

```r
browseVignettes(package = "highr")
```

To install the development version here, use

```r
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**](http://yihui.org/knitr/).