-
-
Notifications
You must be signed in to change notification settings - Fork 30
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
Fix README anchor link collision #12
base: main
Are you sure you want to change the base?
Conversation
the link to `#readme` in TOC goes to the top of README file rather than the "readme" section, as the section name collides with an id already inserted into the page by Github. fixed by linking to a different anchor
Good find, thank you for reporting this. You've discovered a much bigger issue that just this repo: what I'm seeing is that any repo that has a "README" headline and uses an editor with a TOC generator (such as VS Code with Markdown TOC plugin) may have a similar kind of failure. What you've found seems to also be a GitHub software regression. The broken behavior is new, and caused by GitHub staff. The broken behavior is also problematic because in general software should respect explicit user settings (i.e. the headline is definitely explicit "README" and is not "USER-CONTENT-README") rather than munging it. Would you like the credit for reporting this to GitHub? Or if not, let me know, and I'll report it to them. You can see the problem in more detail in the new README.md page that I just uploaded, where all the TOC links are explicit, and I replaced all the Markdown headlines You can also see the GitHub rendering problem has a much wider blast radius, by trying any other Markdown renderer. The vast majority of these that generate header ids do default to the explicit header text, as a slug, e.g. "Hello World" becomes "hello-world" (whereas GitHub renders it as "user-content-hello-word"). My preferred solution is for GitHub's internal non-standardized renderer to respect the haader explicit text (and slugify it), and also absolutely for sure respect any existing explicit id items on the page. |
Interesting that explicitly chosen ids would also get modified. Maybe my memory is faulty but I remember them working fine before. Yes, please go ahead and report this to Github thank you! |
Good, will do. I do need the links to work via typical editor "slugification" extensions, because I use tooling that auto-calculates header id anchors and corresponding TOC links, and I also have hundreds of open source repos to maintain, and they need to work similarly on other git hosts. I'll keep this issue open while GitHub staff looks at the issue. Ticket is https://support.github.com/ticket/personal/0/1958156 |
Any updates? |
Microsoft/GitHub did not fix the issue, and deleted the ticket. For me, it's a can't fix (for the time being) within the repo because the problem is definitely due to Microsoft/GitHub wrapping. |
the link to
#readme
in TOC goes to the top of README file rather than the "readme" section, as the section name collides with an id already inserted into the page by Github. fixed by linking to a different anchor.