enhancementformat:Mangood first issuereader
描述
While converting mandoc pages to html, i expected pandoc to include links to sections when specifying the --toc flag, this did not work. I tried comparing with a small markdown example, which works as expected.
Expected output:
Source:
## Name
text
## Synposis
text
Command:
pandoc --toc -s --from markdown --to html < test.md > test.html
Output:
<body>
<nav id="TOC" role="doc-toc">
<ul>
<li><a href="[#name](view-source:file:///home/teo/programming/manbib/test.html#name)" id="toc-name">Name</a></li>
<li><a href="[#synposis](view-source:file:///home/teo/programming/manbib/test.html#synposis)" id="toc-synposis">Synposis</a></li>
</ul>
</nav>
<h2 id="name">Name</h2>
<p>text</p>
<h2 id="synposis">Synposis</h2>
<p>text</p>
</body>
Faulty output
Source:
.TH TEST "1" "MAY 2023" "TEO UTILS" "cmds"
.SH NAME
.PP
text
.SH SYNOPSIS
.PP
text
Command:
pandoc --toc -s --from man --to html < test.1 > test.html
Output
<body>
<header id="title-block-header">
<h1 class="title">TEST</h1>
<p class="date">MAY 2023</p>
</header>
<nav id="TOC" role="doc-toc">
<ul>
<li>NAME</li>
<li>SYNOPSIS</li>
</ul>
</nav>
<h1>NAME</h1>
<p>text</p>
<h1>SYNOPSIS</h1>
<p>text</p>
</body>
Workaround
pandoc --from man --to markdown < test.1 | pandoc -s --toc --from markdown --to html > test.html
<body>
<nav id="TOC" role="doc-toc">
<ul>
<li><a href="[#name](view-source:file:///home/teo/programming/manbib/test.html#name)" id="toc-name">NAME</a></li>
<li><a href="[#synopsis](view-source:file:///home/teo/programming/manbib/test.html#synopsis)" id="toc-synopsis">SYNOPSIS</a></li>
</ul>
</nav>
<h1 id="name">NAME</h1>
<p>text</p>
<h1 id="synopsis">SYNOPSIS</h1>
<p>text</p>
</body>
Pandoc version
(tried both locally and at try pandoc)
pandoc 3.0.1
Features: +server +lua
Scripting engine: Lua 5.4