Skip to contents

Highlights code

Usage

highlighter(
  code,
  language = "r",
  theme = "default",
  plugins = NULL,
  width = "100%",
  height = "auto",
  elementId = NULL
)

Arguments

code

The code to be highlighted

language

The programming language chosen to be highlighted

theme

A character. Indicating which theme will be used

plugins

Optional. A list of plugins to be used

width

Optional. The width to be used by the widget

height

Optional. The height to be used by the widget

elementId

Optional. The DOM element id to be used by the widget

Value

An object of class highlighter

See also

get_available_languages() for available languages, get_available_themes() for available themes

Examples

# Highlight R code
if (interactive()) {
  highlighter("print('Hello, world!')", language = "r")
}