It looks like this adds #target links to H[1-6], right? I’ve seen discussion about this before and the solution was to insert HTML in the Markdown to create the targets. It seems like it’d be easy enough to roll that into core.
When @eviltrout added the anchor functionality in core he did postpone the automagic anchor creation because it’s not that simple, since you need to pick up a pattern, parse the entire post to deduplicate anchors, etc
That explains it. I mostly think that anyone who cares about the ability to link to headings would also bother to make them unique. It doesn’t seem that bad if a link goes the wrong place if someone is careless. That’s what HTML does, after all. (But maybe there’s something else I’m missing.)
Nice work, @acaporrini! Thanks for contributing this nifty plugin. Is there any way you could envision adding a shortcode e.g. [toc] to generate a table of contents of headings and sub-headings within a post? This would make a long termdream a reality for me.
I’m not sure this blue bookmark icon is really needed - it would be fine, in my view, for this to be a hidden feature that power users can use to deep link to sections within posts.
I don’t think we’d need to rely on hover and agree it is noisy. Maybe headings can simply become links to themselves that can be selected via long press or ctrl/right click? Only issue there would be headings where people create links as in eg below, but not sure this would matter for the vast majority of cases.
# [this is a heading](https://someurl.com)
I still like @mcwumbly’s suggestion from back in the day: