Open
Description
I am trying to add custom html to an htmlwidget as per
https://cran.r-project.org/web/packages/htmlwidgets/vignettes/develop_advanced.html#custom-widget-html
To replicate the issue I have create a simple htmlwidget package with minimal code using
htmlwidgets::scaffoldWidget("mywidget")
I added some custom html for the widget johndharrison/simplewidget@23b38b3
The widget displays correctly and the custom html functions as expected. However htmlwidgets::saveWidget
does not save the widget html as expected:
install.github("johndharrison/simplewidget")
library(simplewidget)
library(xml2)
library(magrittr)
sw <- simplewidget("hello, world")
tFile <- tempfile(fileext = ".html")
htmlwidgets::saveWidget(sw, file = tFile)
browseURL(tFile)
xml2::read_html(tFile) %>%
xml2::xml_find_all("//div[@id='htmlwidget_container']") %>%
as.character
[1] "<div id=\"htmlwidget_container\">\n<div>\n<pre><code><h1 id=\"someid\">My header</h1>\n<div id=\"htmlwidget-00d700b400000a3685d7\" style=\"width:960px;height:500px;\" class=\"simplewidget html-widget\"></div></code></pre>\n</div>\n</div>"
Metadata
Metadata
Assignees
Labels
No labels