diff --git a/DESCRIPTION b/DESCRIPTION index a5492bcfc5..63c25b45db 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: knitr Type: Package Title: A General-Purpose Package for Dynamic Report Generation in R -Version: 1.43.7 +Version: 1.43.8 Authors@R: c( person("Yihui", "Xie", role = c("aut", "cre"), email = "xie@yihui.name", comment = c(ORCID = "0000-0003-0645-5666")), person("Abhraneel", "Sarma", role = "ctb"), diff --git a/NEWS.md b/NEWS.md index d9c6d09371..0a5c2736ba 100644 --- a/NEWS.md +++ b/NEWS.md @@ -22,6 +22,8 @@ - In-body chunk options (`#|`) are now preserved when extracting code from a document via `purl()` (thanks, @LuisLauM, #2268). +- A warning message will be issued when taking screenshots for HTML widgets in PDF with the **webshot2** package, because **webshot2** doesn't use the correct figure size at the moment (thanks, @icejean, #2276). + # CHANGES IN knitr VERSION 1.43 ## NEW FEATURES diff --git a/R/plot.R b/R/plot.R index 1c89138f2a..945d97181f 100644 --- a/R/plot.R +++ b/R/plot.R @@ -611,6 +611,11 @@ html_screenshot = function(x, options = opts_current$get(), ...) { w = webshot_available() webshot = c(options$webshot, names(w)[w]) webshot = if (length(webshot) == 0) 'webshot' else webshot[[1L]] + if (webshot == 'webshot2' && ext == 'pdf' && getOption('knitr.warn.webshot2', TRUE)) warning( + "webshot2 may take the PDF screenshot with the wrong size. You are recommended ", + "to use the 'png' format instead (i.e., set the chunk option dev = 'png'). ", + "See https://github.com/yihui/knitr/issues/2276 for more information." + ) f = in_dir(d, { if (i1 || i3) { if (i1) {