-
Notifications
You must be signed in to change notification settings - Fork 327
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
Do not add outputs when results = 'hide' is set #1600
base: main
Are you sure you want to change the base?
Conversation
Let's make it a draft for now, because I want to check something regarding |
Ok so for R, there is a difference between plots and text outputs
So it may requires some similar logic for filtering output in the reticulate engine 🤔 but honestly, I think this could be ok to ignore this (at least for now). I don't see how |
Thanks for the PR!
Looking at the docs here: https://yihui.org/knitr/options/
It is pretty clear that I can imagine that some users use that chunk option to suppress unwanted text output, while still displaying plots. I find it interesting that evaluating a Should we take a similar approach here? (Should this options be handled in knitr, like |
That would be the scenario - I agree.
We do it globally through Writing this, I am now seeing this is different behavior than in R engine where we filter output any output for which Maybe this difference is ok. My understanding is that anything that comes from an external non-R engine will be considered by knitr as text output. There is no non-text object handled in this case. So
What approach do you have in mind related to graphic device ? |
I'm not sure. Python plots from The question I suppose we should resolve: is html or image chunk output considered "text", when determining if the Consider: what if a user changes a global option in their document, which changes the output emitted by a chunk. Output can be either raw html, an svg, an image, or a plot on the R graphics device. But regardless of how it is emitted, the representation in the final rendered document is roughly the same. Does the Based on the knitr chunk option documentation, my understanding would be that I think the best we can aim for is consistency with the behavior of the R engine. If I'm understanding correctly, the knitr R engine with chunk option I am open to what you think is best. |
closes #1599
As mentioned,
include
is handled by knitr directly since a long timehttps://github.com/yihui/knitr/blob/44a7bee566afff3eb4c8b13fd6fa64487e12981f/R/block.R#L350
so I replaced by
results = 'hide'
information.It also seems that there are two places where output is handled (because of specific handling for matplotlib, so I added the if check there too
I think this is all that is missing for results to be supported.
If you prefer to keep
is_include
for safety, then we can add it back in eachif