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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
use NonZeroU32;
use EcoString;
use ;
use NonZeroExt;
use crateSourceResult;
use cratebail;
use crateEngine;
use crate;
use crateTagged;
use crate;
/// Marks content as a PDF artifact.
///
/// Artifacts are parts of the document that are not meant to be read by
/// Assistive Technology (AT), such as screen readers. Typical examples include
/// purely decorative images that do not contribute to the meaning of the
/// document, watermarks, or repeated content such as page numbers.
///
/// Typst will automatically mark certain content, such as page headers,
/// footers, backgrounds, and foregrounds, as artifacts. Likewise, paths and
/// shapes are automatically marked as artifacts, but their content is not.
/// Repetitions of table headers and footers are also marked as artifacts.
///
/// Once something is marked as an artifact, you cannot make any of its
/// contents accessible again. If you need to mark only part of something as an
/// artifact, you may need to use this function multiple times.
///
/// If you are unsure what constitutes an artifact, check the [Accessibility
/// Guide]($guides/accessibility/#artifacts).
///
/// In the future, this function may be moved out of the `pdf` module, making it
/// possible to hide content in HTML export from AT.
// TODO: maybe generalize this and use it to mark html elements with `aria-hidden="true"`?
/// The type of artifact.
/// A summary of the purpose and structure of a complex table.
///
/// This will be available for Assistive Technology (AT), such as screen
/// readers, when exporting to PDF, but not for sighted readers of your file.
///
/// This field is intended for instructions that help the user navigate the
/// table using AT. It is not an alternative description, so do not duplicate
/// the contents of the table within. Likewise, do not use this for the core
/// takeaway of the table. Instead, include that in the text around the table
/// or, even better, in a [figure caption]($figure.caption).
///
/// If in doubt whether your table is complex enough to warrant a summary, err
/// on the side of not including one. If you are certain that your table is
/// complex enough, consider whether a sighted user might find it challenging.
/// They might benefit from the instructions you put here, so consider printing
/// them visibly in the document instead.
///
/// The API of this feature is temporary. Hence, calling this function requires
/// enabling the `a11y-extras` feature flag at the moment. Even if this
/// functionality should be available without a feature flag in the future, the
/// summary will remain exclusive to PDF export.
///
/// ```example
/// #figure(
/// pdf.table-summary(
/// // The summary just provides orientation and structural
/// // information for AT users.
/// summary: "The first two columns list the names of each participant. The last column contains cells spanning multiple rows for their assigned group.",
/// table(
/// columns: 3,
/// table.header[First Name][Given Name][Group],
/// [Mike], [Davis], table.cell(rowspan: 3)[Sales],
/// [Anna], [Smith],
/// [John], [Johnson],
/// [Sara], [Wilkins], table.cell(rowspan: 2)[Operations],
/// [Tom], [Brown],
/// ),
/// ),
/// // This is the key takeaway of the table, so we put it in the caption.
/// caption: [The Sales org now has a new member],
/// )
/// ```
/// Explicitly defines a cell as a header cell.
///
/// Header cells help users of Assistive Technology (AT) understand and navigate
/// complex tables. When your table is correctly marked up with header cells, AT
/// can announce the relevant header information on-demand when entering a cell.
///
/// By default, Typst will automatically mark all cells within [`table.header`]
/// as header cells. They will apply to the columns below them. You can use that
/// function's [`level`]($table.header.level) parameter to make header cells
/// labelled by other header cells.
///
/// The `pdf.header-cell` function allows you to indicate that a cell is a
/// header cell in the following additional situations:
///
/// - You have a **header column** in which each cell applies to its row. In
/// that case, you pass `{"row"}` as an argument to the [`scope`
/// parameter]($pdf.header-cell.scope) to indicate that the header cell
/// applies to the row.
/// - You have a cell in [`table.header`], for example at the very start, that
/// labels both its row and column. In that case, you pass `{"both"}` as an
/// argument to the [`scope`]($pdf.header-cell.scope) parameter.
/// - You have a header cell in a row not containing other header cells. In that
/// case, you can use this function to mark it as a header cell.
///
/// The API of this feature is temporary. Hence, calling this function requires
/// enabling the `a11y-extras` feature flag at the moment. In a future Typst
/// release, this functionality may move out of the `pdf` module so that tables
/// in other export targets can contain the same information.
///
/// ```example
/// >>> #set text(font: "IBM Plex Sans")
/// #show table.cell.where(x: 0): set text(weight: "medium")
/// #show table.cell.where(y: 0): set text(weight: "bold")
///
/// #table(
/// columns: 3,
/// align: (start, end, end),
///
/// table.header(
/// // Top-left cell: Labels both the nutrient rows
/// // and the serving size columns.
/// pdf.header-cell(scope: "both")[Nutrient],
/// [Per 100g],
/// [Per Serving],
/// ),
///
/// // First column cells are row headers
/// pdf.header-cell(scope: "row")[Calories],
/// [250 kcal], [375 kcal],
/// pdf.header-cell(scope: "row")[Protein],
/// [8g], [12g],
/// pdf.header-cell(scope: "row")[Fat],
/// [12g], [18g],
/// pdf.header-cell(scope: "row")[Carbs],
/// [30g], [45g],
/// )
/// ```
/// Explicitly defines this cell as a data cell.
///
/// Each cell in a table is either a header cell or a data cell. By default, all
/// cells in [`table.header`] are header cells, and all other cells data cells.
///
/// If your header contains a cell that is not a header cell, you can use this
/// function to mark it as a data cell.
///
/// The API of this feature is temporary. Hence, calling this function requires
/// enabling the `a11y-extras` feature flag at the moment. In a future Typst
/// release, this functionality may move out of the `pdf` module so that tables
/// in other export targets can contain the same information.
///
/// ```example
/// #show table.cell.where(x: 0): set text(weight: "bold")
/// #show table.cell.where(x: 1): set text(style: "italic")
/// #show table.cell.where(x: 1, y: 0): set text(style: "normal")
///
/// #table(
/// columns: 3,
/// align: (left, left, center),
///
/// table.header[Objective][Key Result][Status],
///
/// table.header(
/// level: 2,
/// table.cell(colspan: 2)[Improve Customer Satisfaction],
/// // Status is data for this objective, not a header
/// pdf.data-cell[✓ On Track],
/// ),
/// [], [Increase NPS to 50+], [45],
/// [], [Reduce churn to \<5%], [4.2%],
///
/// table.header(
/// level: 2,
/// table.cell(colspan: 2)[Grow Revenue],
/// pdf.data-cell[⚠ At Risk],
/// ),
/// [], [Achieve \$2M ARR], [\$1.8M],
/// [], [Close 50 enterprise deals], [38],
/// )
/// ```
/// Which table track a header cell labels.
/// Used to delimit content for tagged PDF.
}
}
pdf_marker_tag!