yihui / knitr

A general-purpose tool for dynamic report generation in R
https://yihui.org/knitr/
2.36k stars 873 forks source link

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

Closed cderv closed 10 months ago

cderv commented 1 year ago

option was added a while back in 464d4d0d0fe605dcc82bc3c5a8feb277e5f416ad

Related to https://github.com/quarto-dev/quarto-cli/pull/5670 by @mcanouil as Quarto should have probably known about this option from opts_chunk

@yihui any reason not to add it ?

Thanks!

cderv commented 1 year ago

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