external_highlight: Multi-language source code highlighter

View source: R/external_highlight.R

external_highlightR Documentation

Multi-language source code highlighter

Description

Multi-language source code highlighter

Usage

external_highlight(
  file,
  outfile = stdout(),
  theme = "kwrite",
  lang = NULL,
  type = "HTML",
  line_numbers = FALSE,
  doc = TRUE,
  code
)

Arguments

file

Source file to highlight

outfile

Destination of the highlighted code. When NULL, the code is simply returned as a character vector

theme

One of the themes. See highlight_themes for the list of available themes.

lang

The language in which the code is to be interpreted. If this argument is not given, it will be deduced from the file extension.

type

Output format. See highlight_output_types for the list of supported output types.

line_numbers

if TRUE, the result will include line numbers

doc

if TRUE, the result is a stand alone document, otherwise, just a portion to include in a document

code

If given, then the source code is not read from the file

Value

Nothing if outfile is given, with the side effect of writing into the file. The result as a character vector if outfile is NULL

See Also

highlight to highlight R code using the information from the parser


highlight documentation built on Jan. 22, 2023, 1:38 a.m.