You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I don't know if this is expected behavior, or an issue to fix, but this would be some improvement.
It seems output hook is using options sets by engine or function in the chunk (like options$results = 'asis'), but others like chunk hook will only use the current chunk option as the one set in the source code
Example
```{r, echo=FALSE}
knitr::knit_engines$set(demo = function(options) { options[["results"]] <- "asis" knitr::engine_output( options, options$code, out = "Should be `asis` content." ) })local({ ohook <- knitr::knit_hooks$get("chunk") knitr::knit_hooks$set(chunk = function(x, options) { if (options$results != "asis" && nzchar(x)) { x <- paste(c("::: {.wrapped}", x, ":::"), collapse = "\n") } ohook(x, options) }) ohook2 <- knitr::knit_hooks$get("output") knitr::knit_hooks$set(output = function(x, options) { x <- ohook2(x, options) if (options$results != "asis" && nzchar(x)) { x <- paste(c("::: {.internal}", x, ":::"), collapse = "\n") } x })})``````{r}1 + 1``````{demo}Do no matter```
Currently in Quarto only setting output: asis explicitly on the cell will allow to remove the external wrapping of output.
Quarto redifines the chunk hook for this wrapping and checks the options$results
I wonder if there should be a mechanism for knitr hooks to consider the options as redefined possibly by the cell behavior and not just the explicit definition on cell options.
The text was updated successfully, but these errors were encountered:
I don't know if this is expected behavior, or an issue to fix, but this would be some improvement.
It seems
output
hook is using options sets by engine or function in the chunk (likeoptions$results = 'asis'
), but others likechunk
hook will only use the current chunk option as the one set in the source codeExample
The
.wrapped
div is never removed, while the.internal
div is removed if theresults == "asis"
as set by the engine in this example.This is related to
Currently in Quarto only setting
output: asis
explicitly on the cell will allow to remove the external wrapping of output.Quarto redifines the chunk hook for this wrapping and checks the
options$results
I wonder if there should be a mechanism for knitr hooks to consider the options as redefined possibly by the cell behavior and not just the explicit definition on cell options.
The text was updated successfully, but these errors were encountered: