Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Are custom anchors in GitHub Markdown an officially supported feature? #36577

Closed
1 task done
Marcono1234 opened this issue Mar 1, 2025 · 4 comments
Closed
1 task done
Labels
content This issue or pull request belongs to the Docs Content team

Comments

@Marcono1234
Copy link
Contributor

Code of Conduct

What article on docs.github.com is affected?

https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax#custom-anchors

What part(s) of the article would you like to see updated?

Section "Custom anchors"

I don't necessarily want the section to be changed, but rather would like to know if custom anchors are really officially supported by GitHub-flavored Markdown.
#33531 which added this section seems to have been written by a non-GitHub employee, and also #33531 (comment) by a GitHub employee rather sounds like this is just describing the current behavior, without actually giving any guarantees.

For reference, GitHub's handling of custom anchors was changed in the past and did break custom anchors in multiple projects, see https://github.com/orgs/community/discussions/50962.

Additional information

No response

@Marcono1234 Marcono1234 added the content This issue or pull request belongs to the Docs Content team label Mar 1, 2025
@github-actions github-actions bot added the triage Do not begin working on this issue until triaged by the team label Mar 1, 2025
@subatoi
Copy link
Contributor

subatoi commented Mar 3, 2025

Thanks for raising an issue, @Marcono1234—I'll look into this in case there's something in our docs that needs to be changed.

For reference, GitHub's handling of custom anchors was changed in the past and did break custom anchors in multiple projects, see https://github.com/orgs/community/discussions/50962.

Can you give me an example of where custom anchors were broken? I tested this and I couldn't replicate the behaviour you described in that linked issue.

@subatoi subatoi added waiting for review Issue/PR is waiting for a writer's review and removed triage Do not begin working on this issue until triaged by the team labels Mar 3, 2025
@subatoi
Copy link
Contributor

subatoi commented Mar 3, 2025

@Marcono1234 I can confirm the anchors themselves aren't an officially supported feature. I'll leave this open for now to give you time to have a look at the question above, but otherwise this issue will be closed soon.

@subatoi subatoi added more-information-needed More information is needed to complete review and removed waiting for review Issue/PR is waiting for a writer's review labels Mar 3, 2025
@Marcono1234
Copy link
Contributor Author

Can you give me an example of where custom anchors were broken? I tested this and I couldn't replicate the behaviour you described in that linked issue.

See google/gson#2286, and try for example the TOC links at the top of https://github.com/google/gson/blob/gson-parent-2.10/UserGuide.md; I am rather certain that they did work at some point in the past (but unfortunately the Web Archive does not have such an old version of that GitHub page archived).

Though weirdly enough with a quick GitHub code search I found for example https://github.com/cinar/checker/blob/ea60113fa1f75da6d2aa8a00010bbbcc15448fee/DOC.md where uppercase custom name anchors do work.
So I am not completely sure why it does not work for the Gson UserGuide.md.


I can confirm the anchors themselves aren't an officially supported feature.

Should the GitHub documentation then clarify this? Otherwise users might rely on this too much, and are then annoyed when the GitHub Markdown processing changes and their custom anchors don't work anymore.

@subatoi
Copy link
Contributor

subatoi commented Mar 11, 2025

See google/gson#2286, and try for example the TOC links at the top of https://github.com/google/gson/blob/gson-parent-2.10/UserGuide.md; I am rather certain that they did work at some point in the past (but unfortunately the Web Archive does not have such an old version of that GitHub page archived).

I'm confused, because those anchors don't match the headers? For example #TOC-Goals-for-Gson isn't equivalent to the slugified version of Goals for Gson because it has TOC- in front of it. Did that previously work?

(Edited) My apologies, I misread and completely mixed this up with another piece of work.

I've taken another look at it now and I can see exactly what you mean.

Should the GitHub documentation then clarify this? Otherwise users might rely on this too much, and are then annoyed when the GitHub Markdown processing changes and their custom anchors don't work anymore.

I'll investigate whether there's anything we can do to avoid this sort of situation in the future and what exactly happened, but I can't commit to that specific resolution.

Since we've resolved the original question, I'm going to close this issue out. Thank you for reporting it.

@subatoi subatoi added more-information-needed More information is needed to complete review and removed more-information-needed More information is needed to complete review labels Mar 11, 2025
@subatoi subatoi closed this as completed Mar 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
content This issue or pull request belongs to the Docs Content team
Projects
None yet
Development

No branches or pull requests

3 participants
@Marcono1234 @subatoi and others