Clarification on Anchor Links & Adding docs about Anchor Links

The Exercism Markdown docs does not seem to document how to create internal Anchor Links.

According to this forum thread and this PR, there are copy-buttons for headers in the Exercism docs, which I can see in some places, but there is no documentation for this.

It is rather confusing, as the copy buttons only appear on certain sections of the website. For example, the Dig Deeper approach docs and articles seem to not have them.

Additionally, if one tries to do it manually, they (may?) need to prepend “h-” to the anchor. This PR seems to indicate that it is automatically added (at least sometimes), but as I’m not familiar with the website code (or Ruby in general), I’m not sure when this auto-prepending actually happens.

I can’t seem to find any documentation on this issue either (it came up in this PR about this file linking to this Approach section). The link with the anchor copy-pasted from the site’s HTML works, but I’m unsure if the site might prepend an additional “h-”, which would mess up the link.

(Pinging @BethanyG, as they wanted to know the answer to this as well.)

1 Like

Update: It seems like prepending “h-” works (at least for ref-links in Dig Deeper articles). The map() link here is a live example of it working.

This doesn’t prove that it always works, though, so any input is still appreciated! Once everything is cleared up, the details should definitely be added to the docs.

If I remember correctly, all the HTML generation from Markdown is done by a third party library. And the h- prefix came in with an update to that library a longer time ago. So by now, all parts of the website should have a prefix and links without are outdated.

But I’m also in favor of adding documentation about that to the Markdown docs.