File: code_highlight.Rd

package info (click to toggle)
r-cran-cli 3.6.4-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 4,288 kB
  • sloc: ansic: 16,412; cpp: 37; sh: 13; makefile: 2
file content (39 lines) | stat: -rw-r--r-- 1,124 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/prettycode.R
\name{code_highlight}
\alias{code_highlight}
\title{Syntax highlight R code}
\usage{
code_highlight(code, code_theme = NULL, envir = NULL)
}
\arguments{
\item{code}{Character vector, each element is one line of code.}

\item{code_theme}{Theme see \code{\link[=code_theme_list]{code_theme_list()}}.}

\item{envir}{Environment to look up function calls for hyperlinks.
If \code{NULL}, then the global search path is used.}
}
\value{
Character vector, the highlighted code.
}
\description{
Syntax highlight R code
}
\details{
See \code{\link[=code_theme_list]{code_theme_list()}} for the default syntax highlighting theme and
how to change it.

If \code{code} does not parse, then it is returned unchanged and a
\code{cli_parse_failure} condition is thrown. Note that this is not an error,
and the condition is ignored, unless explicitly caught.
}
\examples{
code_highlight(deparse(ls))
cat(code_highlight(deparse(ls)), sep = "\n")
}
\seealso{
Other syntax highlighting: 
\code{\link{code_theme_list}()}
}
\concept{syntax highlighting}