Could this be a theme component?
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.