code_highlight | R Documentation |
Syntax highlight R code
code_highlight(code, code_theme = NULL, envir = NULL)
code |
Character vector, each element is one line of code. |
code_theme |
Theme see |
envir |
Environment to look up function calls for hyperlinks.
If |
See code_theme_list()
for the default syntax highlighting theme and
how to change it.
If code
does not parse, then it is returned unchanged and a
cli_parse_failure
condition is thrown. Note that this is not an error,
and the condition is ignored, unless explicitly caught.
Character vector, the highlighted code.
Other syntax highlighting:
code_theme_list()
code_highlight(deparse(ls))
cat(code_highlight(deparse(ls)), sep = "\n")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.