html_esc: Escape Characters With Special HTML Meaning

Description Usage Arguments Value See Also Examples

View source: R/misc.R

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

1

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

1
2
html_esc("day > night")
html_esc("<SPAN>hello world</SPAN>")

Example output

[1] "day &gt; night"
[1] "&lt;SPAN&gt;hello world&lt;/SPAN&gt;"

fansi documentation built on May 25, 2021, 9:06 a.m.