Skip to content

Conversation

cderv
Copy link
Collaborator

@cderv cderv commented Feb 4, 2025

fixes #9184 and fixes #9185

This PR introduces a hack to work with the new behavior of knitr 1.49 that helps by passing options$results = "asis" to output hook context.

However, quarto does check for options$results == "asis" outside of this output hook context and knitr does not modify the option in the whole cell context. (This could be something done too yihui/knitr#2333)

So to make the change in knitr solves the problem at quarto level, modified options needs to be saved for the remaining cell context handling (until chunk hook).

This PR do that by

  • refactoring the way we provide custom R functions for the rendering, by using a specific tools environment
  • Provide functions to work with this enviromment
  • Leverage this to save the state of asis output

Opening as draft to run our CI checks.

cderv added 7 commits February 4, 2025 16:24
With knitr 1.49, using sew.knit_asis correctly pass modified options$results = "asis" to output hooks for consideration.

However, quarto checks for options$results == "asis" in more places and knitr does not modified the cell option outside of output hook context.

So we need quarto to save the step from output hook context to be reused through the rest of chunk hook processing.

This change correctly make asis_output() results don't have unnecessary cell div
@cderv cderv force-pushed the knitr/asis_output branch from f267a9c to 40ae02c Compare February 4, 2025 22:24
@cscheid cscheid added this to the v1.8 milestone Apr 2, 2025
@cderv cderv modified the milestones: v1.8, Future Sep 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[knitr] asis_output() has not the same effect as output: asis [knitr] custom engine setting asis output does not remove all divs

2 participants