Support variable expansion in cache.path (e.g. cache/INPUT/FORMAT/) #13494
Replies: 3 comments 6 replies
This comment has been hidden.
This comment has been hidden.
-
Thanks for the request, but this is not something we will do because the potential for confusion is far too high. |
Beta Was this translation helpful? Give feedback.
-
Take the following Quarto document ---
title: "Cache"
format:
html: default
typst: default
execute:
cache: true
---
```{r}
rnorm(10)
``` ❯ tree quarto-cache_cache
quarto-cache_cache
├── html
│ ├── __packages
│ ├── unnamed-chunk-1_6d52297f680715667de89e75ccdf4bb5.RData
│ ├── unnamed-chunk-1_6d52297f680715667de89e75ccdf4bb5.rdb
│ └── unnamed-chunk-1_6d52297f680715667de89e75ccdf4bb5.rdx
└── typst
├── __packages
├── unnamed-chunk-1_733527c90b181e7587d2d1e232ba7458.RData
├── unnamed-chunk-1_733527c90b181e7587d2d1e232ba7458.rdb
└── unnamed-chunk-1_733527c90b181e7587d2d1e232ba7458.rdx
3 directories, 8 files This is the Now let's compare with ---
title: "Cache"
output:
html_document: default
pdf_document: default
---
```{r}
#| cache: true
rnorm(10)
``` ❯ tree rmarkdown-cache_cache
rmarkdown-cache_cache
├── html
│ ├── __packages
│ ├── unnamed-chunk-1_dc9020897fffba271d062d6828d12778.RData
│ ├── unnamed-chunk-1_dc9020897fffba271d062d6828d12778.rdb
│ └── unnamed-chunk-1_dc9020897fffba271d062d6828d12778.rdx
└── latex
├── __packages
├── unnamed-chunk-1_3cfbbd2805f549614e6e5c7c0b87bc30.RData
├── unnamed-chunk-1_3cfbbd2805f549614e6e5c7c0b87bc30.rdb
└── unnamed-chunk-1_3cfbbd2805f549614e6e5c7c0b87bc30.rdx
3 directories, 8 files Now, if you set ---
title: "Cache"
output:
html_document: default
pdf_document: default
---
```{r}
#| cache: true
#| cache-path: shared_cache/
rnorm(10)
``` ❯ tree shared_cache
shared_cache
├── __packages
├── unnamed-chunk-1_5d0d0fbdccb42e859943b699a1b060c6.RData
├── unnamed-chunk-1_5d0d0fbdccb42e859943b699a1b060c6.rdb
└── unnamed-chunk-1_5d0d0fbdccb42e859943b699a1b060c6.rdx
1 directory, 4 files Same thing happens in Quarto. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Description
Hi Quarto team,
I’d like to request support for variable expansion in the
cache.path
option inside_quarto.yml
and document front matter.Currently, in knitr’s documentation, the cache path is described as:
where:
INPUT
= the input filename (without extension)FORMAT
= the output format (html, pdf, docx, etc.)However, when I try to set in
_quarto.yml
:the literal string
INPUT
andFORMAT
are not expanded. Instead, the cache directory is created atshared_cache/INPUT/FORMAT/
.Feature request:
Support token expansion in
cache.path
, so that users can write e.g.cache/INPUT/FORMAT/
in_quarto.yml
, and Quarto will replaceINPUT
with the source file name andFORMAT
with the target format name.Why this is useful:
Right now, the only workaround is to programmatically set
cache.path
in a setup chunk using R code but this must be duplicated across documents, which isn’t as clean as a declarative_quarto.yml
setting.Thanks for considering this feature!
Beta Was this translation helpful? Give feedback.
All reactions