Skip to content

Commit

Permalink
Restore object that knitr uses (#162)
Browse files Browse the repository at this point in the history
* Restore object that knitr uses

* Re-document
  • Loading branch information
hadley authored Jun 20, 2024
1 parent 82bb972 commit 14c9609
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
4 changes: 3 additions & 1 deletion R/eval.R
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,14 @@ evaluate <- function(input,
log_echo = FALSE,
log_warning = FALSE,
new_device = TRUE,
output_handler = new_output_handler(),
output_handler = NULL,
filename = NULL,
include_timing = FALSE) {
stop_on_error <- as.integer(stop_on_error)
stopifnot(length(stop_on_error) == 1)

output_handler <- output_handler %||% default_output_handler

if (isTRUE(include_timing)) {
warning("`evaluate(include_timing)` is deprecated")
}
Expand Down
6 changes: 6 additions & 0 deletions R/zzz.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# used by knitr to avoid overheard of calling new_output_handler() repeatedly
default_output_handler <- NULL

.onLoad <- function(...) {
default_output_handler <<- new_output_handler()
}
2 changes: 1 addition & 1 deletion man/evaluate.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 14c9609

Please sign in to comment.