mirror of
https://github.com/jgm/pandoc.git
synced 2026-09-02 13:45:49 +00:00
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>
38 lines
714 B
Markdown
38 lines
714 B
Markdown
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." ]
|
|
]
|
|
```
|