-
Notifications
You must be signed in to change notification settings - Fork 432
Expand file tree
/
Copy pathtypst-image-alt-text.qmd
More file actions
64 lines (45 loc) · 2.16 KB
/
typst-image-alt-text.qmd
File metadata and controls
64 lines (45 loc) · 2.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
---
title: "Typst image alt text support"
format:
typst:
keep-typ: true
_quarto:
tests:
typst:
noErrors: default
ensureTypstFileRegexMatches:
- # Patterns that MUST be found - alt text in image() calls
- 'image\("tc2-inline\.svg",\s*alt:\s*"TC2 inline image'
- 'image\("tc3-explicit\.svg",\s*alt:\s*"TC3 explicit alt attribute'
- 'image\("tc4-dimensions\.svg",\s*alt:\s*"TC4 with dimensions",\s*height:\s*1in,\s*width:\s*1in'
- 'image\("tc5-quotes\.svg",\s*alt:\s*"TC5 with \\"escaped\\" quotes'
- 'image\("tc6-backslash\.svg",\s*alt:\s*"TC6 backslash C:\\\\path'
# TC7 should have the image but without alt parameter
- 'image\("tc7-no-alt\.svg"\)'
# TC8: Explicit fig-alt should produce alt text
- 'image\("tc8-fig-alt\.svg",\s*alt:\s*"TC8 explicit fig-alt'
- # Patterns that must NOT be found
# TC1 figure caption should NOT be used as alt text
- 'tc1-figure\.svg.*alt:.*TC1 figure caption'
# TC7 with no caption/alt should NOT have alt parameter
- 'tc7-no-alt\.svg.*alt:'
---
# Test Document: Typst Image Alt Text
This tests that Quarto passes alt text to Typst's `image()` function for PDF/UA accessibility.
## TC1: Figure with alt text from caption

## TC2: Inline image with alt text
Here is an icon  in the text.
## TC3: Explicit alt attribute (different from caption)
{alt="TC3 explicit alt attribute"}
## TC4: Image with dimensions should preserve alt
Here is {width=1in height=1in} inline.
## TC5: Alt text with special characters (quotes)
{alt="TC5 with \"escaped\" quotes"}
## TC6: Alt text with backslashes
{alt="TC6 backslash C:\\path\\file"}
## TC7: Image with no alt text (should omit alt parameter)
This image has no caption and no alt attribute.

## TC8: Explicit fig-alt on a figure
{fig-alt="TC8 explicit fig-alt description"}