A single model summary can run to forty lines, and a document with a dozen of them becomes a document about its own output. Quarto folds source code with code-fold, but the output beneath it stays where it is.
collapse-output does the same for the output. A cell marked output-fold: true has its results wrapped in a <details> element, so the reader opens the ones they care about.
Installation
quarto add mcanouil/quarto-collapse-output@1.6.1
This will install the extension under the _extensions subdirectory. If you are using version control, you will want to check in this directory.
Then mark a cell with output-fold: true, and its output is folded while the source stays where it was:
```{python}for i inrange(24):print(f"line {i}")```
Standard Output (24 lines)
line 0
line 1
line 2
line 3
line 4
line 5
line 6
line 7
line 8
line 9
line 10
line 11
line 12
line 13
line 14
line 15
line 16
line 17
line 18
line 19
line 20
line 21
line 22
line 23
Every fold on this site is produced that way, by the filter, as the page is rendered.
Fold every cell in the document instead, and opt individual ones out:
See the Reference for every option, and the Examples for each of them rendered.
Note
The filter acts on the cell and cell-output elements Quarto emits, not on any one engine. Examples runs Python through Jupyter and Examples in R runs R through knitr; neither is configured differently.
Where it works
HTML formats. <details> is an HTML element, so in every other format the output is left exactly as it was, unfolded and complete.