Add auto_identifiers support to Man Reader (#11675)

Add support for the `auto_identifiers`, `gfm_auto_identifiers`, and
`ascii_identifiers` extensions in the man reader. Section headings
parsed from .SH and .SS macros now receive auto-generated id
attributes when the extension is enabled, enabling `--toc` to
produce working anchor links.

- Add `autoIdExtensions` to default man extensions [behavior change]
- Add `HasReaderOptions`, `HasLogMessages` and `HasIdentifierList` to
  `ManState` to run `registerHeader`

Closes #8852.
This commit is contained in:
Meher Chaitanya
2026-05-30 19:11:14 +02:00
committed by GitHub
parent c6ba4d9040
commit 1ffeb856ee
7 changed files with 89 additions and 21 deletions
+1 -1
View File
@@ -11,7 +11,7 @@ another \
one;123456
.TE
^D
<h1>HEADING</h1>
<h1 id="heading">HEADING</h1>
<table>
<tbody>
<tr>
+1 -1
View File
@@ -16,7 +16,7 @@ This should still be indented, until some other macro is called to change it.
Like this.
^D
<p>TH "TEST" "1" "2026-05-25" "test v1.0.0" "test manual"</p>
<h1>HEADING</h1>
<h1 id="heading">HEADING</h1>
<dl>
<dt>This is the unindented tag.</dt>
<dd>
+43
View File
@@ -0,0 +1,43 @@
Github Formatted Markdown Identifiers
```
% pandoc -f man+gfm_auto_identifiers -t html
.TH "TEST" "1" "2026-05-08" "test v1.0.0" "test manual"
.SH 1st HEADING
.SH C++ & Rust
.SH HEADING
.SH HEADING
^D
<h1 id="1st-heading">1st HEADING</h1>
<h1 id="c--rust">C++ &amp; Rust</h1>
<h1 id="heading">HEADING</h1>
<h1 id="heading-1">HEADING</h1>
```
Ascii Identifiers test
```
% pandoc -f man+ascii_identifiers -t html
.TH "TEST" "1" "2026-05-08" "test v1.0.0" "test manual"
.SH Über den Flüssen
^D
<h1 id="uber-den-flussen">Über den Flüssen</h1>
```
Headers without Auto Identifiers test
```
% pandoc -f man-auto_identifiers -t native
.TH "TEST" "1" "2026-05-08" "test v1.0.0" "test manual"
.SS Level 2
.SS different styles:
.SS Ordered
.SS Ordered
^D
[ Header
2 ( "" , [] , [] ) [ Str "Level" , Space , Str "2" ]
, Header
2
( "" , [] , [] )
[ Str "different" , Space , Str "styles:" ]
, Header 2 ( "" , [] , [] ) [ Str "Ordered" ]
, Header 2 ( "" , [] , [] ) [ Str "Ordered" ]
]
```