Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

html

Interpret input text as HTML-formatted text


Description

For certain pieces of text (like in column labels or table headings) we may want to express them as raw HTML. In fact, with HTML, anything goes so it can be much more than just text. The html() function will guard the input HTML against escaping, so, your HTML tags will come through as HTML when rendered... to HTML.

Usage

html(text, ...)

Arguments

text, ...

The text that is understood to be HTML text, which is to be preserved.

Value

A character object of class html. It's tagged as an HTML fragment that is not to be sanitized.

Figures

Function ID

7-2

See Also

Examples

# Use `exibble` to create a gt table;
# when adding a title, use the `html()`
# helper to use html formatting
tab_1 <-
  exibble %>%
  dplyr::select(currency, char) %>%
  gt() %>%
  tab_header(
    title = html("<em>HTML</em>"))

gt

Easily Create Presentation-Ready Display Tables

v0.2.2
MIT + file LICENSE
Authors
Richard Iannone [aut, cre] (<https://orcid.org/0000-0003-3925-190X>), Joe Cheng [aut], Barret Schloerke [aut] (<https://orcid.org/0000-0001-9986-114X>), RStudio [cph, fnd]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.