Skip to content

Commit

Permalink
close #2276: issue a warning message in case of chunk options webshot…
Browse files Browse the repository at this point in the history
… = 'webshot2' and dev = 'pdf'
  • Loading branch information
yihui committed Aug 28, 2023
1 parent 42bbf65 commit 574025f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -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"),
Expand Down
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions R/plot.R
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 574025f

Please sign in to comment.