html: Interpret input text as HTML-formatted text

Description Usage Arguments Value Figures Function ID See Also Examples

View source: R/helpers.R

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

1

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

Other Helper Functions: adjust_luminance(), cell_borders(), cell_fill(), cell_text(), cells_body(), cells_column_labels(), cells_column_spanners(), cells_footnotes(), cells_grand_summary(), cells_row_groups(), cells_source_notes(), cells_stub_grand_summary(), cells_stub_summary(), cells_stubhead(), cells_stub(), cells_summary(), cells_title(), currency(), default_fonts(), escape_latex(), google_font(), gt_latex_dependencies(), md(), pct(), px(), random_id()

Examples

1
2
3
4
5
6
7
8
9
# 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 documentation built on May 12, 2021, 9:05 a.m.