Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Type: Package
Package: htmltools
Title: Tools for HTML
Version: 0.5.8.9000
Version: 0.5.8.1
Authors@R: c(
person("Joe", "Cheng", , "[email protected]", role = "aut"),
person("Carson", "Sievert", , "[email protected]", role = c("aut", "cre"),
Expand Down
4 changes: 3 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# htmltools (development version)
# htmltools 0.5.8.1

* `capturePlot()`s examples are now only run when `interactive()`. (#429)

# htmltools 0.5.8

Expand Down
14 changes: 7 additions & 7 deletions R/images.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,20 +17,20 @@
#' @seealso [plotTag()] saves plots as a self-contained `<img>`
#' tag.
#'
#' @examples
#' @examplesIf rlang::is_interactive()
#' # Default settings
#' res <- capturePlot(plot(cars))
#'
#' # View result
#' if (interactive()) browseURL(res)
#' browseURL(res)
#'
#' # Clean up
#' unlink(res)
#'
#' # Custom width/height
#' pngpath <- tempfile(fileext = ".png")
#' capturePlot(plot(pressure), pngpath, width = 800, height = 375)
#' if (interactive()) browseURL(pngpath)
#' browseURL(pngpath)
#' unlink(pngpath)
#'
#' # Use a custom graphics device (e.g., SVG)
Expand All @@ -41,7 +41,7 @@
#' grDevices::svg,
#' width = 8, height = 3.75
#' )
#' if (interactive()) browseURL(svgpath)
#' browseURL(svgpath)
#' unlink(svgpath)
#' }
#'
Expand Down Expand Up @@ -131,14 +131,14 @@ capturePlot <- function(expr, filename = tempfile(fileext = ".png"),
#'
#' @seealso [capturePlot()] saves plots as an image file.
#'
#' @examples
#' @examplesIf rlang::is_interactive()
#' img <- plotTag({
#' plot(cars)
#' }, "A plot of the 'cars' dataset", width = 375, height = 275)
#'
#' if (interactive()) img
#' img
#'
#' if (interactive() && capabilities("cairo")) {
#' if (capabilities("cairo")) {
#' plotTag(
#' plot(pressure), "A plot of the 'pressure' dataset",
#' device = grDevices::svg, width = 375, height = 275, pixelratio = 1/72,
Expand Down
9 changes: 5 additions & 4 deletions man/capturePlot.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions man/plotTag.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.