-
Notifications
You must be signed in to change notification settings - Fork 410
Description
Description
fig-alt attributes on figures are not propagated to Typst's image(alt: "...") parameter. This causes PDF/UA-1 validation failures when using pdf-standard: ua-1 with Typst output.
Root Cause
In src/resources/filters/quarto-pre/figures.lua, the fig-alt propagation in quarto_pre_figures() only handles HTML and LaTeX output formats. The Typst format is missing:
-- propagate fig-alt
if _quarto.format.isHtmlOutput() then
-- handles HTML
elseif _quarto.format.isLatexOutput() then
-- handles LaTeX
end
-- No Typst branch!The Typst post-filter in quarto-post/typst.lua (render_typst_fixups) correctly looks for image.attributes["alt"] and generates image(alt: "..."), but the attribute is never set for Typst output because figures.lua doesn't propagate fig-alt to the Image node's alt attribute.
Steps to Reproduce
- Create a Quarto document with a figure that has
fig-alt:--- format: typst: pdf-standard: ua-1 keep-typ: true --- ```{r} #| label: fig-cars #| fig-cap: "A plot of the cars dataset" #| fig-alt: "Scatter plot of speed versus stopping distance" plot(cars) ```
- Render with
quarto render - Inspect the generated
.typfile — the image has noalt:parameter - Typst compilation fails with
PDF/UA-1 error: missing alt text
Expected Behavior
The generated Typst should include:
#box(image("figure.svg", alt: "Scatter plot of speed versus stopping distance"))Fix
Add a Typst branch to the fig-alt propagation in figures.lua, similar to the LaTeX branch, that sets image.attributes["alt"] from the fig-alt attribute.