Provide a more general method for saving HTML
Nobody has claimed this yet.
- Dominant language
- R
- Stars
- 2.7k
- Forks
- 641
- PR merge metrics
- No merged PRs in 30d
Description
Users shouldn't have to remember when to do htmlwidgets::saveWidget() vs htmltools::save_html() and the subtle differences between them.
Moreover, I want a way to save HTML tags without all the fuss of htmltools::save_html(), and I'm tired of waiting for https://github.com/rstudio/htmltools/issues/73
save_html <- function(x, file, selfcontained = TRUE, libdir = NULL, background = "white", knitrOptions = list()) {
save_fun <- if (inherits(x, "htmlwidget")) {
htmlwidgets::saveWidget
} else if (inherits(x, "shiny.tag")) {
save_tags
} else {
stop("x must be an htmlwidget or an HTML tag list", call. = FALSE)
}
save_fun(x, file, selfcontained, libdir, background, knitrOptions)
}
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by comparing htmlwidgets::saveWidget() with htmltools::save_html() and review the proposed save_html() wrapper, including its htmlwidget and shiny.tag cases. Done means one general saving method handles both supported input types and the listed options without requiring users to choose between the existing functions.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- html, r
- Domain
- web-dev
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 32/100