html_tag | R Documentation |
Given a tag name, generate an HTML tag with optional attributes and content.
html_tag()
can be viewed as a simplified version of htmltools::tags
,
html_value()
adds classes on the value so that it will be treated as raw
HTML (not escaped by html_tag()
), html_escape()
escapes special
characters in HTML, and html_view()
launches a browser or viewer to view
the HTML content.
html_tag(.name, .content = NULL, .attrs = NULL, ...)
html_value(x)
html_escape(x, attr = FALSE)
html_view(x, ...)
.name |
The tag name. |
.content |
The content between opening and closing tags. Ignored for
void tags such as |
.attrs |
A named list of attributes. |
... |
For |
x |
A character vector to be treated as raw HTML content for
|
attr |
Whether to escape |
A character string.
xfun::html_tag("a", "<R Project>", href = "https://www.r-project.org", target = "_blank")
xfun::html_tag("br")
xfun::html_tag("a", xfun::html_tag("strong", "R Project"), href = "#")
xfun::html_tag("a", list("<text>", xfun::html_tag("b", "R Project")), href = "#")
xfun::html_escape("\" quotes \" & brackets < >")
xfun::html_escape("\" & < > \r \n", attr = TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.