Skip to content

Commit f82c072

Browse files
committed
provide default chunk options for sew methods
1 parent bc6d312 commit f82c072

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/resources/rmd/patch.R

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,13 @@ assignInNamespace("add_html_caption", add_html_caption, ns = "knitr")
121121
if (utils::packageVersion("knitr") >= "1.32.8") {
122122
knitr_sew <- knitr:::sew
123123
sew <- function(x, options = list(), ...) {
124-
124+
125+
# some sew s3 methods take the default chunk options
126+
if (missing(options) &&
127+
inherits(x, c("knit_image_paths", "html_screenshot", "knit_embed_url"))) {
128+
options <- knitr::opts_chunk$get()
129+
}
130+
125131
if (inherits(x, "knit_image_paths")) {
126132
knitr:::sew.knit_image_paths(x, options, ...)
127133
} else if (inherits(x, "knit_asis")) {

0 commit comments

Comments
 (0)