Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for svglite at chunk evaluation time #2273

Merged
merged 4 commits into from
Aug 16, 2023
Merged
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
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