mirror of
https://github.com/jgm/pandoc.git
synced 2026-08-26 10:16:32 +00:00
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:
@@ -11,7 +11,7 @@ another \
|
||||
one;123456
|
||||
.TE
|
||||
^D
|
||||
<h1>HEADING</h1>
|
||||
<h1 id="heading">HEADING</h1>
|
||||
<table>
|
||||
<tbody>
|
||||
<tr>
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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++ & 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" ]
|
||||
]
|
||||
```
|
||||
Reference in New Issue
Block a user