quarto-dev / quarto-dev/quarto-cli
Feature request: For quarto book qmd files, allow execution order to differ from order appearing in book
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 6k
- Forks
- 458
- Avg merge
- 1d 9h
- Merged PRs (30d)
- 41
Description
I have the following common use case:
- writing a report with many qmd chapters
- each chapter calculates key facts (in R)
- up-front summary chapter reprises key facts in text with inline code and perhaps includes a summary table
Thus, I need to calculate the facts in the body-of-the-report chapters before executing the code for the summary chapter, but I want the summary to appear first. It would be great to define an execution order for the files and an appearance order for the files that may be different, so that I could calculate the summary chapter last but have it appear first.
There are workarounds, of course, such as:
- Calculate everything first - for example, R files executed at the start that do all calculations, and the qmd files merely report the results (tables, figures, inline text). But this makes for a potentially awkward and error-prone workflow as it requires thinking about the whole project and its presentation separately. A more-natural workflow (for me) is to develop the calculations at the same time and in the same place that I am figuring out how to present the information.
- Have every full execution create and save results into a prior-results folder. In the next execution these results will be available to the summary chapter at the start. Requires being extra-careful that the results have not changed from one execution to the next, or putting in error checking to be sure that, after all files are executed, the current results are the same as prior results.
Neither of these seems as good as having the ability to separate execution order from appearance order.
Would love to hear if there are better workarounds - or perhaps quarto already has this capability and I haven't found it yet.
Many thanks.
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 locating the Quarto book rendering and execution-order entry points; the issue names no files or tests. Trace how qmd chapters are ordered during rendering, then determine how separate execution and appearance orders could be represented and validated.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- r
- Domain
- build-system
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100