Skip to content

Typst writer: propagate lang attribute on Span elements #11673

@cwickham

Description

@cwickham

The Typst writer ignores the lang attribute on bracketed Span elements.

This means PDFs produced via the Typst writer can't meet WCAG 2.2 Success Criterion 3.1.2 (Language of Parts) for inline language changes.

The HTML and LaTeX writers handle the same input appropriately.

Related. #10965 added support for lang on Divs in the Typst writer; this issue covers the analogous Span case.

Example

Given test.md:

Hello [bonjour, monde]{lang=fr} world.

Run:

pandoc -f markdown -t typst test.md

Actual

Hello bonjour, monde world.

Expected

Hello #text(lang: "fr")[bonjour, monde] world.

Typst itself propagates #text(lang: "...") into the PDF's tagged structure as /Lang marked-content attributes (verified with Typst 0.14.2), so the downstream toolchain is ready to receive the right output.

Other formats

For comparison

HTML

pandoc -f markdown -t html test.md
<p>Hello <span lang="fr">bonjour, monde</span> world.</p>

LaTeX

pandoc -f markdown -t latex test.md
Hello \foreignlanguage{french}{bonjour, monde} world.

Pandoc version: pandoc 3.9.0.2 on macOS 26.5

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions