For the markdown version, you can now include a heading:
### My Heading
My Heading
And copy the auto-anchor link it creates by clicking/long-pressing next to it:
https://meta.discourse.org/t/markdown-links-to-anchors-not-working/150175/7#my-heading-1
https://meta.discourse.org/t/markdown-links-to-anchors-not-working/150175/7#my-heading-1