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

Shorten markdown heading anchors links #11903

Merged
merged 1 commit into from
Jun 26, 2020
Merged

Conversation

silverwind
Copy link
Member

@silverwind silverwind commented Jun 15, 2020

This changes the links on headings like '# Usage' in markdown from

https://host/user/repo#user-content-usage

to just

https://host/user/repo#usage

matching GitHub and GitLab. The linked id elements still have the prefix and this behaviour matches GitHub and GitLab too, so JS is needed to scroll to the active anchor. I suspect it's like that to avoid namespace collission between user-generated content and other page content. Compatibilty for old links is included so they will continue to work.

Also included are some enhancements to make the clickable area for the link icon larger and fix its color on arc-green.

Fixes: #11896

@techknowlogick techknowlogick added the topic/ui Change the appearance of the Gitea UI label Jun 15, 2020
@lafriks lafriks added this to the 1.13.0 milestone Jun 16, 2020
@silverwind silverwind force-pushed the anchors branch 2 times, most recently from 0ef83fb to dc1ad46 Compare June 17, 2020 18:32
@silverwind silverwind changed the title Markdown anchors rework Shorten markdown heading anchors links Jun 17, 2020
@silverwind
Copy link
Member Author

Rebased and updated issue title/description. Maybe it's now easier to understand what this does.

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Jun 17, 2020
@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Jun 18, 2020
@silverwind
Copy link
Member Author

Bump

This changes the links on headings like '# Usage' in markdown from

  `https://host/user/repo#user-content-usage`

to just

  `https://host/user/repo#usage`

matching GitHub and GitLab. The linked id elements still have the prefix
and this behaviour matches GitHub and GitLab too, so JS is needed to
scroll to the active anchor. I suspect it's like that to avoid namespace
collission between user-generated content and other page content.
Compatibilty for old links is included so they will continue to work.

Also included are some enhancements to make the clickable area for the
link icon larger and fix its color on arc-green.

Fixes: go-gitea#11896
Fixes: go-gitea#12062
@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Jun 26, 2020
@lunny lunny merged commit 9c54fef into go-gitea:master Jun 26, 2020
@silverwind silverwind deleted the anchors branch June 26, 2020 13:11
ydelafollye pushed a commit to ydelafollye/gitea that referenced this pull request Jul 31, 2020
This changes the links on headings like '# Usage' in markdown from

  `https://host/user/repo#user-content-usage`

to just

  `https://host/user/repo#usage`

matching GitHub and GitLab. The linked id elements still have the prefix
and this behaviour matches GitHub and GitLab too, so JS is needed to
scroll to the active anchor. I suspect it's like that to avoid namespace
collission between user-generated content and other page content.
Compatibilty for old links is included so they will continue to work.

Also included are some enhancements to make the clickable area for the
link icon larger and fix its color on arc-green.

Fixes: go-gitea#11896
Fixes: go-gitea#12062
@go-gitea go-gitea locked and limited conversation to collaborators Nov 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. topic/ui Change the appearance of the Gitea UI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Markdown anchors should not have user-content- prefix in href
6 participants