panflute icon indicating copy to clipboard operation
panflute copied to clipboard

Nav and other HTML5 elements missing

Open Eloitor opened this issue 2 years ago • 0 comments

The filter fixtoc.py no longer has the desired behavior explained here: https://stackoverflow.com/questions/42664314/make-master-table-of-contents-covering-several-separate-input-files-using-pandoc

Using the solution described there gives pandoc --number-sections --file-scope --toc -s *.md | pandoc -s -f html -o toc.html -F fixtoc.py -M files:"*.md"

<body>
<header id="title-block-header">
<h1 class="title">01_introduction</h1>
</header>
<ul>
<li><a href="#introduction"><span class="toc-section-number">1</span> Introduction</a>
<ul>
<li><a href="#section-1.1"><span class="toc-section-number">1.1</span> Section 1.1</a></li>
<li><a href="#section-1.2"><span class="toc-section-number">1.2</span> Section 1.2</a></li>
</ul></li>
<li><a href="#functional-description"><span class="toc-section-number">2</span> Functional Description</a>
<ul>
<li><a href="#section-2.1"><span class="toc-section-number">2.1</span> Section 2.1</a></li>
<li><a href="#section-2.2"><span class="toc-section-number">2.2</span> Section 2.2</a></li>
</ul></li>
</ul>
</body>

Note that there is no <div id="TOC"> element. This is because the default pandoc template for html has switched to <nav id="TOC">.

This can be temporaly fix using html 4 between the two pandoc calls.

pandoc -t html4 --number-sections --file-scope --toc -s *.md | pandoc -s -f html -o toc.html -F fixtoc.py -M files:"*.md"

However if panflute had HTML5 elements, the conversion could be done to html5 directly.

Eloitor avatar Dec 28 '21 11:12 Eloitor