Skip to content

fix: propagate fig-alt to Typst image alt text for PDF/UA-1#14110

Open
gordonwoodhull wants to merge 1 commit intomainfrom
bugfix/14108
Open

fix: propagate fig-alt to Typst image alt text for PDF/UA-1#14110
gordonwoodhull wants to merge 1 commit intomainfrom
bugfix/14108

Conversation

@gordonwoodhull
Copy link
Contributor

Summary

  • Fix fig-alt not being propagated to Typst's image(alt: "...") parameter for computed figures (R/Python code chunks)
  • Refactor figures.lua to make fig-alt propagation format-agnostic instead of having separate HTML/LaTeX/Typst branches
  • Add test case verifying fig-alt on R code chunks produces image(alt: ...) in Typst output

Details

The fig-alt propagation in quarto-pre/figures.lua only handled HTML and LaTeX outputs. The Typst post-filter in quarto-post/typst.lua correctly looks for image.attributes["alt"] and generates image(alt: "..."), but the attribute was never set for Typst output.

The fix refactors the three format-specific branches into a single block:

  • HTML: sets alt on the float itself (unchanged behavior)
  • All other formats (LaTeX, Typst, etc.): walks into float.content to set alt on Image nodes

This means any future format will also automatically get fig-alt propagation.

Closes #14108

Test plan

  • New test typst-fig-alt-propagation.qmd passes (verified fig-alt from R chunk → image(alt: ...) in .typ)
  • Existing typst-image-alt-text.qmd passes (caption-as-alt, explicit alt)
  • Existing equations-alt.qmd passes (html, pdf, typst)
  • Existing ua-image-alt-text.qmd passes (pdf, typst)

🤖 Generated with Claude Code

The fig-alt attribute on computed figures (R/Python code chunks) was not
being propagated to Typst's image(alt: "...") parameter, causing PDF/UA-1
validation failures. The propagation logic in figures.lua only handled
HTML and LaTeX outputs. Refactored to make fig-alt propagation
format-agnostic so it works for Typst and any future formats.

Closes #14108

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@posit-snyk-bot
Copy link
Collaborator

posit-snyk-bot commented Feb 24, 2026

Snyk checks have passed. No issues have been found so far.

Status Scanner Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues
Licenses 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@gordonwoodhull gordonwoodhull added this to the v1.10 milestone Feb 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fig-alt not propagated to Typst image alt text for PDF/UA-1 compliance

2 participants