Accessibility

Alt text for figures

Every figure a chunk generates can carry alternative text for screen readers. Set it per chunk with the fig-alt-text display option:

```r
#| fig-alt-text: Fuel efficiency versus horsepower by transmission type
plot(mpg ~ hp, data = mtcars)
```

A document-wide default can be set in calepin.setup(fig-alt-text: ...), but a shared default is rarely good alt text: prefer a specific description on each chunk.

In HTML output, the alt text becomes the alt attribute of the generated <img> element. In paged output, it is passed to Typst’s image(alt: ...), which embeds it in the tagged PDF structure.

Alt text follows the figure when its output is relocated with #calepin.results(...); see Code execution.

A tbl- chunk wraps its printed output in a table figure. That figure holds no image, so Typst cannot describe it on its own; fig-alt-text supplies its description too:

```r
#| label: tbl-summary
#| tbl-caption: First rows of `mtcars`
#| fig-alt-text: Table of the first rows of the mtcars data set
knitr::kable(head(mtcars))
```

Alt text for hand-written elements

Chunk output is only part of a document. Typst elements you write yourself carry their own alt text:

Accessible PDFs (PDF/UA)

Typst can produce tagged, accessible PDFs. Arguments after -- are forwarded to the typst binary, so:

calepin compile paper.typ -- --pdf-standard ua-1

Under ua-1, Typst requires a document title and non-empty alt text on every image and equation, and reports a diagnostic for each violation. In practice:

A third-party Typst package that emits images or figures without alt text will fail a ua-1 build from inside the package, and no option on your side can fix it.

Accessible websites

Calepin’s HTML output uses semantic elements for navigation, headings, and figures. A few things remain yours to provide:

  [[menus.social]]
  target = "https://github.com/example/repo"
  label = "{icon:github}"
  aria-label = "GitHub"