Learn R Programming

html5 (version 1.0.2)

code: Generate the <code> HTML tag.

Description

The <code> HTML element displays its contents styled in a fashion intended to indicate that the text is a short fragment of computer code. By default, the content text is displayed using the user agent default monospace font.

Usage

code(
  ...,
  attr = NULL,
  separate = FALSE,
  collapse = "",
  formatted = html5_vars$formatted
)

Value

A HTML tag string.

Arguments

...

A string or vector of content to pass to the tag.

attr

A named list or named vector, names are attribute names and values are attribute values.

separate

TRUE/FALSE, If TRUE, returns separate tags for each item of ...; if FALSE, returns one tag with the items of ... in the tag content.

collapse

A string. If NULL, returns a vector the same length as ... instead of collapsing the tags into one string.

formatted

TRUE/FALSE, if TRUE, HTML will be generated with indents and new lines for readability at the cost of performance. Controlled by setting the environment variable html5_vars$formatted <- TRUE/FALSE

Details

Learn more at https://developer.mozilla.org/en-US/docs/Web/HTML/Element/code.

Examples

Run this code
code(attr = list(class = "test"))

Run the code above in your browser using DataLab