write_widget | R Documentation |
Writes an HTML widget's main container <div>
and data <script>
tags to file.
write_widget(x, path)
x |
HTML widget object. |
path |
File path to write the HTML widget's core tags to. |
Other than htmlwidgets::saveWidget()
, this function does not write a complete HTML document but only the widget's core tags. Hence it is intended to
create files which are in turn included in another HTML file, e.g. via a static site generator. The HTML widget's dependencies must be handled separately,
e.g. using write_widget_deps()
.
To directly get the HTML widget's core tags as a character scalar, use as.character(htmltools::tagList(x))
.
The content written to path
as a character scalar, invisibly.
Other HTML widget functions:
write_widget_deps()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.