
Check that quartifyr's required/suggested Quarto extensions are installed
Source:R/quarto-extensions.R
check_quarto_extensions.RdCompares quartifyr_quarto_extensions (or a caller-supplied data frame
in the same shape) against quarto::quarto_list_extensions()'s output
for path, and reports anything missing with a clickable
quarto::quarto_add_extension() suggestion for each one.
render_report() calls this itself before rendering, so a missing
required extension stops the render with an actionable message
instead of Quarto's own much less specific "could not find executable"
filter failure. Call it directly to check a project on its own, e.g.
right after install_quartifyr_extension().
Arguments
- path
Project directory to check (the one containing, or that should contain,
_extensions/). Defaults to the current directory.- extensions
Registry to check against. Defaults to quartifyr_quarto_extensions; pass your own data frame in the same shape (optionally
rbind()'d onto the default) to also check project-specific extensions.- error
Whether a missing extension with
required = TRUEraises an error (defaultTRUE, and this is whatrender_report()uses). Extensions withrequired = FALSEnever error, only warn, regardless of this argument.
A quarto_list_extensions() parsing gotcha
quarto::quarto_list_extensions() feeds the quarto list extensions
CLI's plain-text table straight into read.table(text = ..., header = TRUE, fill = TRUE, sep = "") (whitespace-delimited). Confirmed the
hard way: A2-ai/quarto-plus's own Contributes value ("filters,
shortcodes") contains a space, so that row tokenizes to one more
whitespace-separated field than the 3-column header – which triggers
read.table()'s classic "data row has one more field than the header"
rule and silently uses the extension id as a row name instead of
the Id column, shifting Version/Contributes left into
Id/Version for that row only. Trusting df$Id alone would miss
exactly the extension this package cares most about checking for. This
function instead searches every cell and row name of the returned
data frame, so the column shift doesn't matter.
A quarto list extensions project-resolution gotcha
The quarto list extensions CLI command resolves the entire
project's markdown (crawling every .qmd's {{< include >}}
directives and other resource paths) as a side effect of building its
project file list – not just its own installed-extensions output.
Confirmed the hard way: a report project missing a file an included
.qmd points at (e.g. copying report.qmd out of
examples/demo-report/ without also copying its scripts/
directory) makes this command fail with an error about that missing
file, with no mention of extensions at all. This function catches
that and re-raises with a pointer back to the underlying Quarto error
rather than letting Quarto's raw (and, over quarto_render()'s R
wrapper, deeply nested) failure propagate uninterpreted.