If you have an issue comment / PR description on GitHub, it doesn't automatically get anchors / IDs that you could link to:
What I like to do is to add a visible #
character like this:
It renders like this:
Copy/paste-friendly Markdown snippet:
# Some heading <a href="#user-content-some-heading" id="some-heading">#</a>
Don't forget to add the user-content-
prefix to href
– that's how GitHub transforms custom IDs.
Alternatively, if you don't want the visible #
character, you could also do this:
It renders like this:
The same URL as before can be used to link to this heading, e.g.:
https://github.com/borekb/example/issues/123#user-content-second-section
(You can use browser dev tools' Inspect element to find out the anchor.)
Why is that needed at all? For many markdown to html converters this works out of the box (just use
# Foo
and then ...#foo works fine).