Closed simonmichael closed 3 years ago
What version of mdbook-toc are you running? We fixed unique slug generation in v0.6. I can't build your site easily, so I can't test it there.
@badboy: mdbook-toc 0.6.1.
Thanks, I will re-investigate when I get back to this project.
I re-tested with mdbook 0.4.7 and mdbook-toc 0.6.2. It seems to work only if case is the same in both headings:
$ mdbook build && grep -i 'tags<' out/a.html
2021-04-20 16:23:37 [INFO] (mdbook::book): Book building has started
2021-04-20 16:23:37 [INFO] (mdbook::book): Running the html backend
<li><a href="#tags">tags</a></li>
<li><a href="#tags-1">tags</a></li>
<h1 id="tags"><a class="header" href="#tags">tags</a></h1>
<h1 id="tags-1"><a class="header" href="#tags-1">tags</a></h1>
My headings have different capitalisation, which causes an incorrect link in the TOC:
$ mdbook build && grep -i 'tags<' out/a.html
2021-04-20 16:23:22 [INFO] (mdbook::book): Book building has started
2021-04-20 16:23:22 [INFO] (mdbook::book): Running the html backend
<li><a href="#tags">tags</a></li>
<li><a href="#tags">Tags</a></li> <- should be "#tags-1"
<h1 id="tags"><a class="header" href="#tags">tags</a></h1>
<h1 id="tags-1"><a class="header" href="#tags-1">Tags</a></h1>
Thanks! That makes a reproducible test case. I might get to look into this in the coming days.
Heh, it was actually just a minor oversight. Fixed now and release on its way.
Lovely, thanks for the fix and release.
Duplicated headings on a page are not linked correctly, eg: https://hledger.org/hledger.html has a "tags" heading under COMMANDS (https://hledger.org/hledger.html#tags) and a "Tags" heading under JOURNAL FORMAT (https://hledger.org/hledger.html#tags-1). Links in the TOC point only to the first (https://hledger.org/hledger.html#tags). This can be quite confusing.
Related: https://github.com/simonmichael/hledger_site/issues/33, https://github.com/rust-lang/mdBook/issues/1493, https://github.com/rust-lang/mdBook/issues/720