highlight: Syntax highlighting based on the R parser

Description Usage Arguments Value See Also Examples

View source: R/highlight.R

Description

The highlight function performs syntax highlighting based on the results of the parse and the investigation of a detective.

Usage

1
2
highlight(x = read_file(file), detective = lestrade, file,
  header = "<pre class='rcode'>", footer = "</pre>", ...)

Arguments

x

code to highlight. Read from 'file' if supplied

detective

function used to assign styles to tokens

file

code file

header

header

footer

footer

...

extra parameters for the detective

Value

The formatted text, surrounded by 'header' and 'footer'

See Also

[lestrade()] and [sherlock()] for examples of detectives

Examples

1
2
3
4
5
## Not run: 
	highlight( "rnorm(10) + 1", lestrade )
	highlight( "rnorm(10) + 1", sherlock )

## End(Not run)

romainfrancois/highlight documentation built on March 19, 2018, 1:28 p.m.