Description
What?
I'd like Quarto to create all temporary/intermediate files in the given subdirectory of the project root (or /tmp
, or another user-provided directory). By "intermediate files" I mean all files that Quarto manages itself: .aux
, .tex
, .log
, the intermediate .pdf
, the .md
generated from the .qmd
and so on.
I'd like to write something like this in the frontmatter:
project:
output-temp-dir: temporary_files
output-dir: out
This would make Quarto write stuff only to output-dir
and output-temp-dir
and nowhere else. Currently, like knitr/bookdown/Rmarkdown, Quarto will write temporary files to the current directory.
Why?
- I created a Quarto project with the default file
report.qmd
(Quarto markdown). - I tried editing it in RStudio but didn't like it, so I exited RStudio without closing the file.
- I switched to Zettlr, but it couldn't see the file, so I renamed it to
report.md
(regular Markdown). Now it worked and I continued working onreport.md
for a week in Zettlr. - Rendering the file with
quarto render --to pdf
worked great. I simply had to putproject: render: report.md
in_quarto.yml
. - Today I started RStudio and apparently saved
report.qmd
(Quarto markdown!), so that it appeared in my project. Now I had bothreport.md
with a week's worth of work and the almost emptyreport.qmd
. For whatever reason (again, probably RStudio re-saved the old version of_quarto.yml
too) the lineproject: render: report.md
got changed to.qmd
. - I finally finished my work on
report.md
and rendered it:quarto render --to pdf
. report.md
was GONE andreport.pdf
contained whatever nonsensereport.qmd
had.- I attempted to recover
report.md
with various tools, but to no avail.
It looks like in the process of analyzing report.qmd
, Quarto deleted the "old" report.md
, created a new report.md
with the processed contents of report.qmd
, merrily created the PDF from that MD file and then deleted report.md
as an artefact of processing report.qmd
.
Now all my work is gone, and it's kinda my fault because I named my file report.md
and had a report.qmd
alongside it. Also, I could've easily used version control, but deliberately chose not to since I was too lazy to set it up. Which turned out to be a stupid decision. It's also Quarto's fault: it could've looked at the modification dates, wondered why the "temporary" file report.md
is much newer than the "original" report.qmd
and asked me for permission to overwrite report.md
.
I would like Quarto (and knitr/bookdown/RMarkdown/whatever) to do its processing and creating temporary files in /tmp
, because that's where temporary files are supposed to go. Or in output-temp-dir: temporary_files
, as suggested earlier, so that the user can control where the temporary files are going. But not in my working directory, where it can overwrite any important .md
file I spent a week working on.
That would solve all such problems: I write my MD files in my project's directory, Quarto copies everything to /tmp/whatevergibberish
, processes it and puts the output into output-dir
. If the project's settings (or the frontmatter) require to save the .tex
file, then copy it into the output directory as well. This way, the user doesn't have to worry about the processing done by Quarto. They also don't need to worry about Quarto overwriting their .md
files.
Also, all output only goes to output-dir
and Quarto never ever writes to the directory with the user's source files or any other directory besides those marked as output-
: output-temp-dir
and output-dir
.