Surrounding HTML Heading Content with Anchor Tag?

A couple folks reference being able to specify header ID with syntax like:

# My Title {#my-id}

I’ve seen reference to this with both blackfriday and goldmark:

Since you calculate the hid, you might be able to add that extra bit to your print statement, specifying the correct ID.