Skip to content

Commit

Permalink
Add support for svglite at chunk evaluation time (#2273)
Browse files Browse the repository at this point in the history
  • Loading branch information
Darxor authored Aug 16, 2023
1 parent ec4c9b6 commit 4300e49
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
3 changes: 2 additions & 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.2
Version: 1.43.3
Authors@R: c(
person("Yihui", "Xie", role = c("aut", "cre"), email = "[email protected]", comment = c(ORCID = "0000-0003-0645-5666")),
person("Abhraneel", "Sarma", role = "ctb"),
Expand Down Expand Up @@ -152,6 +152,7 @@ Suggests:
tinytex,
webshot,
rstudioapi,
svglite,
xml2 (>= 1.2.0)
License: GPL
URL: https://yihui.org/knitr/
Expand Down
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

- Fixed a bug in `spin(format = 'Rnw')` reported by @Tarious14 at https://github.com/yihui/yihui.org/discussions/769#discussioncomment-6587927

- When the chunk option `dev = 'svglite'`, the `svglite` device should be used to record plots (thanks, @Darxor, #2272).

# CHANGES IN knitr VERSION 1.43

## NEW FEATURES
Expand Down
4 changes: 4 additions & 0 deletions R/block.R
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,10 @@ chunk_device = function(options, record = TRUE, tmp = tempfile()) {
do.call(grDevices::svg, c(list(
filename = tmp, width = width, height = height
), get_dargs(dev.args, 'svg')))
} else if (identical(dev, 'svglite')) {
do.call(svglite::svglite, c(list(
filename = tmp, width = width, height = height
), get_dargs(dev.args, 'svglite')))
} else if (identical(getOption('device'), pdf_null)) {
if (!is.null(dev.args)) {
dev.args = get_dargs(dev.args, 'pdf')
Expand Down

0 comments on commit 4300e49

Please sign in to comment.