One shared FGCZ look-and-feel for Quarto reports (theme + header + defaults),
reusable across ezRun, prolfqua, prolfquapp, …. Reports can opt in to a
top-right toolbar — 🔍 Find any figure or table in a graphical table of
contents, or 📥 Download the plots, the .qmd source and a standalone
copy of the page as a ZIP.
👉 See the documentation site — including a live example report with the real layout, tabsets, figures, and the Find / Download toolbar.
There are two ways to use it. Pick one.
Best when you render with the quarto CLI.
Step 1. In your project, once:
quarto add fgcz/fgczQuartoTemplateThis creates _extensions/fgczQuartoTemplate/ in the project. Without that
extension directory, format: fgczQuartoTemplate-html will fail because Quarto
cannot resolve the custom format.
Step 2. In your report's YAML header:
---
title: "My report"
format: fgczQuartoTemplate-html
---Step 3. Render:
quarto render my_report.qmdDone. ✅
Optional — 🔍 Find / 📥 Download / </> View source toolbar (off by
default). Switch it on and select its buttons in the report header:
format:
fgczQuartoTemplate-html:
include-after-body: _extensions/fgczQuartoTemplate/fgcz-plot-finder.html
fgcz-buttons: [search, download, source]Use fgcz-buttons: search (or any subset, e.g. [search, download]) to pick
individual buttons. Omit fgcz-buttons to show all three when the toolbar is
included. Unknown names stop the render instead of silently hiding controls.
The View source button opens Quarto's own view-source overlay and only
appears when the report was rendered with code-tools: true (a template
default already set in _metadata.yml).
Bonus — "Show code" per plot/table. Any figure/table chunk with
#| label: fig-xxx / #| label: tbl-xxx and a matching fig-cap:/tbl-cap:
automatically gets a small </> badge — on the figure itself and in the Find
panel — that jumps to and highlights that chunk in View Source. No wiring
needed beyond the label; unlabelled chunks show nothing extra.
Optional — tab colour and layout switches (all off by default). Three independent switches in the report header:
fgcz-colour: true # per-nesting-level tab palette (deep blue → indigo)
fgcz-number: true # hierarchical tab numbers: 1, 1.1, 1.1.1 …
fgcz-full-width: true # fill the screen instead of the centred body capfgcz-colour replaces the uniform grey folder tabs with one hue per nesting
level, so depth reads as colour. fgcz-number prefixes every tab label with its
position, counting across sibling tabsets at the same depth; with the toolbar on,
the numbers show up in the Find panel's breadcrumbs too. fgcz-full-width
drops the centred body cap so content fills the screen on large displays (like
the old ezRun html_document); it is unsupported with .column-margin /
.column-screen.
Best when you render from R (e.g. inside a package). No format: line, no quarto add.
Step 1. Install:
remotes::install_github("fgcz/fgczQuartoTemplate")Step 2. Your report's YAML header — just this, nothing FGCZ-specific:
---
title: "My report"
---Step 3. Render with the one-call helper:
fgczQuartoTemplate::fgcz_render("my_report.qmd") # no toolbar
fgczQuartoTemplate::fgcz_render("my_report.qmd", buttons = TRUE) # 🔍 Find / 📥 Download / </> View source
fgczQuartoTemplate::fgcz_render("my_report.qmd", buttons = "search") # 🔍 Find only
fgczQuartoTemplate::fgcz_render("my_report.qmd", colour = TRUE, number = TRUE) # coloured + numbered tabs
fgczQuartoTemplate::fgcz_render("my_report.qmd", full_width = TRUE) # content fills the screenDone. ✅ (fgcz_render copies _metadata.yml, fgcz.scss,
fgcz_header_quarto.html, and fgcz-plot-finder.html next to the .qmd, then
calls quarto::quarto_render(). The toolbar is staged either way but only wired
in when enabled. TRUE and FALSE remain supported; button names allow finer
selection.)
If you want to separate these two steps, copy the assets first and render yourself:
input <- "my_report.qmd"
fgczQuartoTemplate::fgcz_copy_assets(input)
quarto::quarto_render(input)fgcz_copy_assets() accepts either the .qmd path above, or an existing
directory. These two calls are equivalent:
fgczQuartoTemplate::fgcz_copy_assets(input)
fgczQuartoTemplate::fgcz_copy_assets(dirname(normalizePath(input)))| Way 1 — Extension | Way 2 — R helper | |
|---|---|---|
| Install | quarto add … (once per project) |
install_github (once) |
| YAML | format: fgczQuartoTemplate-html |
nothing |
| Render | quarto render |
fgczQuartoTemplate::fgcz_render() |
| Use it when | CLI / non-R pipelines | rendering from R |
Both produce the same report. They can coexist in one repo.
fgcz_render("report.qmd") # stage assets + render (the usual one)
fgcz_render("report.qmd", buttons = TRUE) # ...plus the 🔍 Find / 📥 Download / </> View source toolbar
fgcz_render("report.qmd", buttons = "download") # ...or just 📥 Download
fgcz_render("report.qmd", colour = TRUE) # per-level tab colours
fgcz_render("report.qmd", number = TRUE) # tab numbers 1, 1.1, 1.1.1 …
fgcz_render("report.qmd", full_width = TRUE) # fill the screen (drops margin/screen columns)
fgcz_render("report.qmd", fig_dpi = 150, fig_retina = 1) # smaller self-contained HTML
fgcz_copy_assets("report.qmd") # stage assets next to that file
fgcz_copy_assets("dir") # or stage assets into an existing dir
fgcz_use_template("dir", "report.qmd") # start a new report from the template
fgcz_quarto_dir() # where the installed assets live
fgcz_qmd_source_link() # <a> link to this report's .qmd, for a Report provenance tableQuarto can't reach into an installed R package to fetch styling — the files must
sit next to the .qmd at render time. Two clean ways to get them there:
- Extension:
quarto adddrops them into_extensions/; you opt in withformat:. _metadata.yml: a file with that exact name is auto-applied to every.qmdin its directory (noformat:line); the R helper stages it for you.
inst/quarto/is the only place you hand-edit. Everything else is generated from it byRscript data-raw/sync_assets.R(ormake sync):fgcz.scss,fgcz_header_quarto.html,fgcz-plot-finder.html,fgcz-buttons.lua— byte-copied into_extensions/andvignettes/_extensions/._extensions/fgczQuartoTemplate/_extension.yml(nested, Way 1) — built frominst/quarto/_metadata.yml(flat, Way 2); edit the format options in_metadata.ymlonly.versionis stamped fromDESCRIPTION.vignettes/example-report.qmd— built frominst/quarto/template.qmd(same body, vignette header swapped in); edit the report intemplate.qmd.
- Install the hook once per clone:
make hooks(orgit config core.hooksPath .githooks). It runs the sync and re-stages the generated files on every commit, so editinginst/quarto/is enough. CI (.github/workflows/altdoc.yml) re-runs the sync and fails on any drift as a backstop. - The live example report is the
vignettes/example-report.qmdvignette; the documentation site (built withaltdoc—make site) renders it through Quarto with its tabsets intact.
GPL (>= 3), matching ezRun.