quarto-dev / quarto-dev/quarto-cli
Format-resources behavior
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 6k
- Forks
- 458
- Avg merge
- 1d 9h
- Merged PRs (30d)
- 41
Description
So I am trying to to package my "solution" to Global TeX macros.
For this I wanted to use format-resources to provide the file _macros.qmd with the content
::: {.content-hidden}
```{r, echo=FALSE, results='asis'}
if (knitr::is_html_output()) {
system("latexpand macros.tex -o _macros.tex")
macros <- readLines('_macros.tex')
system("rm _macros.tex")
writeLines(macros)
}
```
:::
I ran into two issues:
- Quarto seems to process the
template.qmdfile first, if I use the header
to include the{{< include _macros.qmd >}}_macros.qmdfile from the extension, then this file is reported as missing - After the template is rendered the
_macros.qmdfile is not deleted. Funnily, the include directive therefore works on second render.
My expectation was, that format-resources would be treated as follows:
copy the format-resources -> render -> delete the format-resources
This was clearly wrong. I think this should work like this, but if there is a reason this does not work like this, then this behavior should probably be documented.
Sidenote: I also dislike the fact that the rendering happens in the root directory to some degree, as the directory always blows up with all the tex auxillary files when rendering to pdf before being deleted again. If something fails the tex files stay around and litter the root directory. Could the rendering of the project not happen in the output directory? I.e. copy the source files to the output directory, render, delete source files
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the two cases with template.qmd and the extension-provided _macros.qmd, using the format-resources entry described in the issue. Trace the render order and resource cleanup, then verify that resources are available before the template include and are removed afterward, or that the documented behavior matches the implementation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- latex, r
- Domain
- build-system, documentation
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100