tagFunction | R Documentation |
Create 'lazily' rendered HTML tags (and/or htmlDependencies()
).
tagFunction(func)
func |
a function with no arguments that returns HTML tags and/or dependencies. |
When possible, use tagAddRenderHook()
to provide both a tag
structure and utilize a render function.
tagAddRenderHook()
myDivDep <- tagFunction(function() {
if (isTRUE(getOption("useDep", TRUE))) {
htmlDependency(
name = "lazy-dependency",
version = "1.0", src = ""
)
}
})
myDiv <- attachDependencies(div(), myDivDep)
renderTags(myDiv)
withr::with_options(list(useDep = FALSE), renderTags(myDiv))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.