-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
feat(typst.hs): Add alt text support for images in Typst writer #11394
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
7df57ac to
cf221db
Compare
for consistency with HTML/LaTeX
cf221db to
9b0df51
Compare
|
As expected, the old test now breaks because it is missing the alt-text generated similarly to LateX and HTML 2026-01-10T22:52:08.1982438Z 9236.md
2026-01-10T22:52:08.2923875Z #1: FAIL (0.01s)
2026-01-10T22:52:08.2924508Z --- test/command/9236.md
2026-01-10T22:52:08.2924933Z +++ pandoc -t typst
2026-01-10T22:52:08.2925448Z + 1 #figure(image("command/minimal.svg", alt: "minimal", width: 3in),
2026-01-10T22:52:08.2926050Z - 1 #figure(image("command/minimal.svg", width: 3in),
2026-01-10T22:52:08.2926503Z + 7 #figure(image("command/minimal.svg", alt: "minimal", height: 2in, width: 3in),
2026-01-10T22:52:08.2926997Z - 7 #figure(image("command/minimal.svg", height: 2in, width: 3in),
2026-01-10T22:52:08.2927403Z + 13 #figure(image("command/minimal.svg", alt: "minimal"),
2026-01-10T22:52:08.2927754Z - 13 #figure(image("command/minimal.svg"),
2026-01-10T22:52:08.2928036Z + 19 And inline:
2026-01-10T22:52:08.2928450Z + 20 #box(image("command/minimal.svg", alt: "minimal", height: 2in)) and
2026-01-10T22:52:08.2929232Z + 21 #box(image("command/minimal.svg", alt: "minimal")).
2026-01-10T22:52:08.2929625Z - 19 And inline: #box(image("command/minimal.svg", height: 2in)) and
2026-01-10T22:52:08.2929994Z - 20 #box(image("command/minimal.svg")).
2026-01-10T22:52:08.2930261Z
2026-01-10T22:52:08.2930499Z Use -p '/9236.md.#1/' to rerun this test only. |
|
I can't seem to make a suggested edit due to the content being markdown. We discovered a couple other test cases in my version of this. |
Closes #13868 Workaround for Pandoc not passing alt text to Typst image() calls. When an image has alt text (from caption or explicit alt attribute), emit raw Typst with image(..., alt: "...") for accessibility. This is a temporary fix until jgm/pandoc#11394 is merged upstream. - Add alt text handling in render_typst_fixups() Image filter - Alt parameter placed second after filename (matches Pandoc PR) - Escape backslashes and quotes in alt text - Add comprehensive test coverage with unique test images - Replace test-image.png with smaller penrose.svg Co-Authored-By: Claude Opus 4.5 <[email protected]>
|
@gordonwoodhull Do you see something else regarding Quarto use? |
|
I’ve implemented a character-for-character equivalent workaround in Quarto as part of quarto-dev/quarto-cli#13857, since we probably won’t update our Pandoc again until 1.10. |
Closes #13868 Workaround for Pandoc not passing alt text to Typst image() calls. When an image has alt text (from caption or explicit alt attribute), emit raw Typst with image(..., alt: "...") for accessibility. This is a temporary fix until jgm/pandoc#11394 is merged upstream. - Add alt text handling in render_typst_fixups() Image filter - Alt parameter placed second after filename (matches Pandoc PR) - Escape backslashes and quotes in alt text - Add comprehensive test coverage with unique test images - Replace test-image.png with smaller penrose.svg Co-Authored-By: Claude Opus 4.5 <[email protected]>
Introduce support for alt text in images within the Typst writer, enhancing accessibility.
Behaviour is by design consistent with LaTeX and HTML writers.
TO-DO: Check if the following files need to account for alt as welltest/command/9945.mdthis might now get an alternative-text not expected at the time.This was identified in Quarto CLI that the alt-text was not forwarded.
Resolves quarto-dev/quarto-cli#13868