Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTML5 writer does not add id="footnotes" to footnote <section> #8043

Closed
gwern opened this issue Apr 26, 2022 · 0 comments
Closed

HTML5 writer does not add id="footnotes" to footnote <section> #8043

gwern opened this issue Apr 26, 2022 · 0 comments
Labels

Comments

@gwern
Copy link
Contributor

gwern commented Apr 26, 2022

Compiling

Test^[footnote 1.]

Foo.

Bar.

Test2^[footnote 2.]

to stand-alone HTML yields

...<body>
<p>Test<a href="#fn1" class="footnote-ref" id="fnref1" role="doc-noteref"><sup>1</sup></a></p>
<p>Foo.</p>
<p>Bar.</p>
<p>Test2<a href="#fn2" class="footnote-ref" id="fnref2" role="doc-noteref"><sup>2</sup></a></p>
<section class="footnotes" role="doc-endnotes">
<hr />
<ol>
<li id="fn1" role="doc-endnote"><p>footnote 1.<a href="#fnref1" class="footnote-back" role="doc-backlink">↩︎</a></p></li>
<li id="fn2" role="doc-endnote"><p>footnote 2.<a href="#fnref2" class="footnote-back" role="doc-backlink">↩︎</a></p></li>
</ol>
</section>
</body>
</html>

<section class="footnotes" role="doc-endnotes"> has no id="footnotes" on it, so it can't be linked. (All other sections would get an ID, as one expects, and can be linked.)

I can't seem to find any documentation explaining if this is deliberate in the source or Github issues, and when I search for ID in the Pandoc source, I get a lot of hits for both HTML and most of the other output formats suggesting that having an ID is the usual behavior and used to be the Pandoc behavior. (I feel like I vaguely remember many years ago Pandoc/Gitit footnotes being full sections just like any other, with <h1> and IDs and all; but I could be wrong.) For example,

$ fgrep -R 'id="footnotes"' * | sort
test/docbook-reader.docbook:<sect1 id="footnotes">
test/jats-reader.xml:<sec id="footnotes">
test/writer.custom:<h1 id="footnotes">Footnotes</h1>
test/writer.docbook4:  <sect1 id="footnotes">
test/writer.docbook5:  <section xml:id="footnotes">
test/writer.fb2:<section id="footnotes">
test/writer.html4:<h1 id="footnotes">Footnotes</h1>
test/writer.html5:<h1 id="footnotes">Footnotes</h1>
test/writer.jats_archiving:<sec id="footnotes">
test/writer.jats_articleauthoring:<sec id="footnotes">
test/writer.jats_publishing:<sec id="footnotes">
test/writer.mediawiki:<span id="footnotes"></span>
test/writer.tei:<div type="level1" xml:id="footnotes">

./test/writer.markua:666:{id: footnotes}
./test/writer.org:782::CUSTOM_ID: footnotes

All of the tests seem to think that footnote sections get IDs? (Although they also look outdated so perhaps they are historical.)

This causes me trouble inasmuch as I want my ToCs to link to the footnotes section properly, and I use JS to inject the ID manually, but this has the side-effect that linkcheckers & validators will complain because the ID doesn't exist (as indeed it does not exist statically, only at runtime in the reader browser). I could just workaround the lack with a sed
<section class="footnotes" role="doc-endnotes"> to
<section class="footnotes" role="doc-endnotes" id="footnotes">, of course, but perhaps this is just a minor Pandoc bug?


I think it would also be good to generate headers & ToC entries for the footnotes section, but that's probably a separate discussion.

@gwern gwern added the bug label Apr 26, 2022
@jgm jgm closed this as completed in 50c9848 Apr 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant