withTags | R Documentation |
tags
This function makes it simpler to write HTML-generating code. Instead of
needing to specify tags
each time a tag function is used, as in
tags$div()
and tags$p()
, code inside withTags
is
evaluated with tags
searched first, so you can simply use
div()
and p()
.
withTags(code, .noWS = NULL)
code |
A set of tags. |
.noWS |
Default whitespace behavior for all tags within this call to
|
If your code uses an object which happens to have the same name as an
HTML tag function, such as source()
or summary()
, it will call
the tag function. To call the intended (non-tags function), specify the
namespace, as in base::source()
or base::summary()
.
# Using tags$ each time
tags$div(class = "myclass",
tags$h3("header"),
tags$p("text")
)
# Equivalent to above, but using withTags
withTags(
div(class = "myclass",
h3("header"),
p("text")
)
)
# Setting .noWS for all tags in withTags()
withTags(
div(
class = "myclass",
h3("header"),
p("One", strong(span("two")), "three")
),
.noWS = c("outside", "inside")
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.