<a href="#cd">...</a>
links to an element with id="cd"
.
You need to have a matching element to link to.
<a href="#cd">...</a>
links to an element with id="cd"
.
You need to have a matching element to link to.
It is related to how GitHub prefixes the id of a heading in order to guard against user content clobbering elements used by CSS or JavaScript, see here for a brief explanation related to this.
then use JavaScript to perform the actual scrolling to user content.
Both links with following anchor-ed a tags:
<a id="user-content-cd" class="anchor" aria-hidden="true" href="#cd"></a>
Why Github works with #cd
(Jump to H2 of cd
section): https://github.com/mitnk/cicada/blob/master/docs/builtins.md#cd
But this one does not work: https://hugo.wang/cicada/builtins.md#cd
??
The anchor on GitHub actually links to this element
They’ve got a bunch of obfuscated JavaScript. It’s probably something to do with that. There’s no reason to use JS instead of plain HTML for that though.