quarto-dev / quarto-dev/quarto-cli
Use `post-render` only when `quarto render` is used
@cscheid is already working on this.
Since Jul 17, 2024.
- Dominant language
- JavaScript
- Stars
- 6k
- Forks
- 458
- Avg merge
- 1d 9h
- Merged PRs (30d)
- 41
Description
Discussed in https://github.com/quarto-dev/quarto-cli/discussions/10310
Originally posted by skwde July 17, 2024
Description
Currently there is no way (at least to my basic knowledge) to run post-render only when quarto render is used.
Consider following case:
When explicitly calling quarto render revealjs-slides.qmd I want to run a post-render step calling decktape to convert the slides to pdf.
In particular it should not run when I use quarto preview revealjs-slides.qmd.
The discussion https://github.com/quarto-dev/quarto-cli/discussions/6080 mentions the use of QUARTO_PROJECT_RENDER_ALL but this does not work if there are other .qmd files in the project.
Here is a working example.
We have the _quarto.yml
project:
post-render:
- test.sh
and the test.sh
#!/usr/bin/env bash
echo "Variables:"
echo ${QUARTO_PROJECT_RENDER_ALL}
echo ${QUARTO_PROJECT_OUTPUT_DIR}
echo ${QUARTO_PROJECT_INPUT_FILES}
echo ${QUARTO_PROJECT_OUTPUT_FILES}
Following test.qmd is used
---
format: revealjs
---
# Test
abc
In addition there is an empty another.qmd.
Running both render and preview on test.qmd shows that the post-render is executed
quarto render test.qmd
quarto preview test.qmd
Maybe another variable QUARTO_PREVIEW would be helpful here.
I use Quarto version 1.5.54 in a devcontainer running debian bookworm.
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.
Assessment
This issue has not been assessed yet.