Renders an "html" object as text in the console: tags are
stripped or translated (<sub>/<sup> become
_/^, <b>/<strong>/<i>/<em>
become bold/italic via ANSI codes), common HTML entities
( , β, ...) are decoded, and <table>
blocks are rendered as aligned text tables.
Usage
# S3 method for class 'html'
preview(x, ...)Arguments
- x
an object of class
"html"- ...
further arguments, currently unused (kept for consistency with
print())
Details
If output does not support ANSI styling, bold/italic markup is rendered as plain text (handled automatically by cli).
See also
Other html:
asFileLink(),
asHtml(),
asImg(),
embedFile(),
escapeHtml(),
htmlNotation,
htmlSubscript,
preview(),
toHtmlTable()
Examples
preview(asHtml(
"<b>Model:</b> y = β<sub>0</sub> + β<sub>1</sub>x + ϵ"
))
#> Model: y = β_0 + β_1x + ε
# tables are rendered as aligned text
m <- matrix(c(12.3, 4.56, 7.8, 91.2), nrow = 2,
dimnames = list(c("a", "b"), c("mean", "sd")))
preview(toHtmlTable(m))
#> | mean | sd
#> --+------+-----
#> a | 12.3 | 7.8
#> b | 4.56 | 91.2
