Official support for custom HTML Markdown anchors #50962
Unanswered
Marcono1234
asked this question in
Other Feature Feedback, Questions, & Ideas
Replies: 2 comments
|
This should be higher priority -- relying on the exact wording of anchors to generate links is extremely brittle. Any minor copy-edit has the capacity to silently break any number of downstream references. |
0 replies
|
The GitHub documentation now describes custom anchor support, but it is not clear if this is actually a supported feature or just a description of the observed behavior from a non-GitHub employee, see github/docs#36577. |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Select Topic Area
Question
Body
Is it documented somewhere whether GitHub officially supports custom HTML anchors in Markdown? For example, in some cases it might be desirable to create anchors without creating a Markdown header, or with a custom anchor ID which can be used for permalinks, regardless of whether the corresponding header is renamed later.
For example:
# <a id="my-anchor"></a> Some header text which could change in the futureApparently GitHub does support
<a>with customidandname(thoughnameis deprecated).The important question is however if this is officially supported (similar to the
<details>tag), or whether the libraries GitHub is using for Markdown rendering just happen to support this, but the behavior might change in the future.In the past it looks like the behavior for this also changed; previously it was possible to use uppercase letters in the anchor (e.g.
<a name="TOC-Overview"></a>), but that is not possible anymore since a few months (?)1. However, all lowercase anchors (including-) still seem to work.Footnotes
Actually, anchors with uppercase letters still kind of work; GitHub still emits them in the HTML, but it does not scroll there anymore. Because GitHub prefixes these anchors with
user-content-you could still use...#user-content-TOC-Overviewbut that seems to directly scroll to that HTML element, not accounting for the floating headers at the top and therefore being cut off. β©All reactions