go-gitea / gitea

Git with a cup of tea! Painless self-hosted all-in-one software development service, including Git hosting, code review, team collaboration, package registry and CI/CD
https://gitea.com
MIT License
45.45k stars 5.52k forks source link

Make Markdown anchors match other major code hosting platforms #17262

Open benatkin opened 3 years ago

benatkin commented 3 years ago

Feature Description

Markdown anchors are generated from headings, and can be used relatively to link inside the code.

Gitea replaces spaces with dashes, while GitHub and GitLab omit the spaces.

GitHub and GitLab match, and Sourcehut mostly matches. I think it would be great if Gitea matched GitHub and GitLab, to ease the migration path.

This change would break links on Gitea repos that use them, but this could be fixed by making it remove the dashes, since it's already using JavaScript to move from #user-content-example-0-sign_in-ts to #example-0-sign_in-ts.

I'm working on Markdown code notebooks so I will likely rely on this more than most, but relative anchor links are used in other projects.

Screenshots

No response

silverwind commented 3 years ago

I think we can take this as a breaking change for the next major release.

braoult commented 2 years ago

I believe we could have the same issue with slash (/) character in headings, where gitea replaces it with dash (-) in anchor, while github removes it.