-
Notifications
You must be signed in to change notification settings - Fork 409
Open
Labels
engines-knitrAnything regarding knitr enginesAnything regarding knitr enginesenhancementNew feature or requestNew feature or request
Milestone
Description
Quarto sets the knitr option quarto.version = 1
quarto-cli/src/resources/rmd/execute.R
Line 300 in 3043993
| quarto.version = 1, |
This is then generally used as a signal that knitr is executing in a Quarto context with a check like
!is.null(knitr::opts_knit$get("quarto.version"))or in some packages, like flextable there are more complicated checks that insinuate that quarto.version might change over time
is_in_quarto <- function() {
if (getRversion() >= numeric_version("4.4.0")) {
isTRUE(knitr::opts_knit$get("quarto.version") > 0)
} else {
isTRUE(knitr::opts_knit$get("quarto.version") > numeric_version("0"))
}
}I think it'd be helpful to have this version match the Quarto binary version. I can't find another way to find out, from R, what exact version of quarto is in use.
In v1.9 I think the following will be possible, but the quarto.version knitr option is definitely easier to access.
jsonlite::read_json(Sys.getenv("QUARTO_EXECUTE_INFO"))[["format"]][["metadata"]][["quarto-version"]]
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
engines-knitrAnything regarding knitr enginesAnything regarding knitr enginesenhancementNew feature or requestNew feature or request