Learn R Programming

fansi (version 0.5.0)

html_esc: Escape Characters With Special HTML Meaning

Description

Arbitrary text may contain characters with special meaning in HTML, which may cause HTML display to be corrupted if they are included unescaped in a web page. This function escapes those special characters so they do not interfere with the HTML markup generated by e.g. sgr_to_html.

Usage

html_esc(x)

Arguments

x

character vector

Value

x, but with "<", ">", "&", "'", and "\"" characters replaced by their HTML entity codes, and Encoding set to UTF-8.

See Also

Other HTML functions: in_html(), make_styles(), sgr_to_html()

Examples

Run this code
# NOT RUN {
html_esc("day > night")
html_esc("<SPAN>hello world</SPAN>")
# }

Run the code above in your browser using DataLab