quarto-dev / quarto-dev/quarto-cli

Use `post-render` only when `quarto render` is used

Open
#10,314 1 comment 0 reactions 1 assignee View on GitHub

@cscheid is already working on this.

Since Jul 17, 2024.

enhancement preview
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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.