Support variable expansion in cache.path (e.g. cache/INPUT/FORMAT/) #13494
Closed
AlbertoFabbri93
started this conversation in
Feature Requests
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. |
0 replies
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 filesThis 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 filesNow, 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 filesSame thing happens in Quarto. |
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment

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.pathoption inside_quarto.ymland 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
INPUTandFORMATare 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 replaceINPUTwith the source file name andFORMATwith the target format name.Why this is useful:
Right now, the only workaround is to programmatically set
cache.pathin a setup chunk using R code but this must be duplicated across documents, which isn’t as clean as a declarative_quarto.ymlsetting.Thanks for considering this feature!
All reactions