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

Footnotes: Multiple references to the same footnotes cause duplicate "id"s in HTML [goldmark] #9757

Closed
kaushalmodi opened this issue Apr 7, 2022 · 1 comment · Fixed by #9822

Comments

@kaushalmodi
Copy link
Contributor

What version of Hugo are you using (hugo version)?

$ hugo version
hugo v0.97.0-DEV-9e360d3844f5077c65649e4c9c98f5cbd1c3efc0

Does this issue reproduce with the latest release?

Yes


This issue probably stems from Goldmark's Footnote extension. But I am opening the issue here first as it was found through Hugo.

Issue

When there are multiple references to the same footnote, the generated <sup> elements for backreferences from the footnote are generated with the same id. This prevents a user to jump back to each of those references separately from the footnote.

The generated HTML page also shows "Duplicate ID" errors on the HTML Validator site.

Recipe to reproduce the issue

something[^fn:1]

something[^fn:1]

something[^fn:1]

[^fn:1]: footnote text

More Info

The Goldmark Footnote extension is inspired from the PHP Markdown Extra - Footnotes extension.

When the above snippet is pasted in the PHP Markdown dingus, we not see this issue of Duplicate IDs:

<p>something<sup id="fnref:fn:1"><a href="#fn:fn:1" class="footnote-ref" role="doc-noteref">1</a></sup></p>

<p>something<sup id="fnref2:fn:1"><a href="#fn:fn:1" class="footnote-ref" role="doc-noteref">1</a></sup></p>

<p>something<sup id="fnref3:fn:1"><a href="#fn:fn:1" class="footnote-ref" role="doc-noteref">1</a></sup></p>

<div class="footnotes" role="doc-endnotes">
<hr />
<ol>

<li id="fn:fn:1" role="doc-endnote">
<p>footnote text&#160;<a href="#fnref:fn:1" class="footnote-backref" role="doc-backlink">&#8617;&#xFE0E;</a> <a href="#fnref2:fn:1" class="footnote-backref" role="doc-backlink">&#8617;&#xFE0E;</a> <a href="#fnref3:fn:1" class="footnote-backref" role="doc-backlink">&#8617;&#xFE0E;</a></p>
</li>

</ol>
</div>

Note that the points from where the same footnote is referenced shows unique IDs: fnref:fn:1, fnref2:fn:1, fnref3:fn:1

References

@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 19, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants