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

Add fig.asp = NULL as default in opts_chunks #2260

Closed
wants to merge 1 commit into from

Conversation

cderv
Copy link
Collaborator

@cderv cderv commented May 25, 2023

option was added a while back in 464d4d0

Related to quarto-dev/quarto-cli#5670 by @mcanouil as Quarto should have probably known about this option from opts_chunk

@yihui any reason not to add it ?

Thanks!

option was added a while back in 464d4d0
@cderv cderv requested a review from yihui May 25, 2023 09:38
Copy link
Owner

@yihui yihui left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, the reason not to add it into opts_chunk is that it will invalidate existing cache, because cache depends on chunk options. This is one thing that I regret very much in knitr since it makes it hard to add new chunk options into opts_chunk.

RStudio uses opts_chunk_attr to recognize chunk options, e.g.,

opts$fig.asp = 'numeric'

but even opts_chunk_attr doesn't contain all available chunk options. Changing this object is risk-free, though.

@cderv
Copy link
Collaborator Author

cderv commented May 25, 2023

Yes, the reason not to add it into opts_chunk is that it will invalidate existing cache, because cache depends on chunk options. This is one thing that I regret very much in knitr since it makes it hard to add new chunk options into opts_chunk.

@mcanouil I knew there was a reason not every option was in opts_chunk ! I couldn't remember why exactly.

The initial trigger of this is that Quarto uses names(knitr::opts_chunk$get()) to know which options are knitr options. And then add others manually.

We could probably do the same as RStudio IDE object but for Quarto, or use the same by providing all options into opts_chunk_attr and use this

@yihui yihui closed this Aug 31, 2023
@yihui yihui deleted the fix/fig.asp-default branch August 31, 2023 05:25
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 28, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants