Files
pandoc/test/command/typst-auto-identifiers.md
T
John MacFarlane ec4fb91049 Typst reader: support auto_identifiers extension.
Headings without an explicit label can now be assigned automatic
identifiers based on the heading text, making them linkable in a
generated table of contents.  The extension is available for the
typst reader but is off by default; enable it with
`-f typst+auto_identifiers`.  The related `gfm_auto_identifiers` and
`ascii_identifiers` extensions are also made available.

Closes #11041.

Text.Pandoc.Readers.Typst.Parsing: PState gains sOptions,
sIdentifiers, and sLogMessages fields, and now has
HasReaderOptions, HasIdentifierList, and HasLogMessages
instances, allowing reuse of the shared registerHeader. (Not an
API change.)

Co-Authored-By: Claude <noreply@anthropic.com>
2026-06-13 23:38:51 +02:00

714 B

With auto_identifiers enabled, headings without an explicit label get automatic identifiers, with collisions disambiguated:

% pandoc -f typst+auto_identifiers -t native
= Introduction

Text.

== A Sub Section

= Introduction
^D
[ Header
    1 ( "introduction" , [] , [] ) [ Str "Introduction" ]
, Para [ Str "Text." ]
, Header
    2
    ( "a-sub-section" , [] , [] )
    [ Str "A" , Space , Str "Sub" , Space , Str "Section" ]
, Header
    1 ( "introduction-1" , [] , [] ) [ Str "Introduction" ]
]

The extension is off by default, so headings have no identifiers:

% pandoc -f typst -t native
= Introduction

Text.
^D
[ Header 1 ( "" , [] , [] ) [ Str "Introduction" ]
, Para [ Str "Text." ]
]