Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

handle knit_asis output correctly without wrapping cell divs #12024

Draft
wants to merge 10 commits into
base: main
Choose a base branch
from

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant