Official support for custom HTML Markdown anchors #50962
Unanswered
Marcono1234
asked this question in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
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 future
Apparently GitHub does support
<a>
with customid
andname
(thoughname
is 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-Overview
but that seems to directly scroll to that HTML element, not accounting for the floating headers at the top and therefore being cut off. ↩Beta Was this translation helpful? Give feedback.
All reactions