html_escape: Escape text for inclusion in HTML

View source: R/html.R

html_escapeR Documentation

Escape text for inclusion in HTML

Description

Escape text for inclusion in HTML

Usage

html_escape(x, attribute = FALSE)

Arguments

x

Character: Text to escape. Coerced with as.character().

attribute

Logical: If TRUE, also escape the quote characters, which must be escaped inside an attribute value but not in element text. Must be a single non-NA TRUE or FALSE.

Value

Character: Escaped text, carrying no class.

Author(s)

EDG

Examples

html_escape("a < b & c")
html_escape('say "hi"', attribute = TRUE)

rtemis.core documentation built on Sept. 20, 2026, 9:06 a.m.