-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
Gitea 1.21.4 adds 'user-content-' in markdown file #29196
Comments
Oh sorry, maybe not related .... need figure out why .... (Actually I can find a related PR for "fixing": Fix README TOC links #22577 ) |
Keep in mind |
@makar112233 what is the exact issue? Does hash navigation not work for you? Keep note it does require having JavaScript enabled to work. |
@silverwind according to the report, and the demo on try.gitea.io, it doesn't work (neither for me). |
Ah yes, I can see the issue on try. Maybe something wrong in https://github.com/go-gitea/gitea/blob/main/web_src/js/markup/anchors.js or does the backend set ids that are incompatible with the JS? |
@silverwind |
Hello. Could this issue be assigned to me? I would like to give a try at solving this. |
Ah I see now that the problem is about the manual TOC links [Review](#_toc152597800)
[Staging](#_toc152597802)
[Development](#_toc152597803)
[Testing](#_toc152597828)
[Unit-tests](#_toc152597829) Renders as <p dir="auto"><a href="#user-content-_toc152597800" rel="nofollow">Review</a></p>
<p dir="auto"><a href="#user-content-_toc152597802" rel="nofollow">Staging</a></p>
<p dir="auto"><a href="#user-content-_toc152597803" rel="nofollow">Development</a></p>
<p dir="auto"><a href="#user-content-_toc152597828" rel="nofollow">Testing</a></p>
<p dir="auto"><a href="#user-content-_toc152597829" rel="nofollow">Unit-tests</a></p> So we need to handle the |
@DanielMatiasCarvalho give it a try. If we don't hear back, I will fix it in a couple of days. |
Thank you in advance, guys. |
@DanielMatiasCarvalho super! Waiting for release) |
This seeks to fix the bug reported on issue #29196. Cause: ID's with custom characters (- , _ , etc.), were not linking correctly in the Markdown file when rendered in the browser because the ID in the respective destinies would be different than the one in anchor, while for IDs with only letters, the ID would be the same. Fix: It was suggested that to fix this bug, it should more or less like GitHub does it. While in gitea the anchors would be put in HTML like this: ``` <p dir="auto"><a href="#user-content-_toc152597800" rel="nofollow">Review</a></p> <p dir="auto"><a href="#user-content-_toc152597802" rel="nofollow">Staging</a></p> <p dir="auto"><a href="#user-content-_toc152597803" rel="nofollow">Development</a></p> <p dir="auto"><a href="#user-content-_toc152597828" rel="nofollow">Testing</a></p> <p dir="auto"><a href="#user-content-_toc152597829" rel="nofollow">Unit-tests</a></p> ``` In GitHub, the same anchor's href properties would be the same without "user-content-" trailing behind. So my code made sure to change those anchors, so it would not include "user-content-" and then add respective Event Listeners so it would scroll into the supposed places. Fixes: #29196 --------- Co-authored-by: silverwind <me@silverwind.io>
This seeks to fix the bug reported on issue go-gitea#29196. Cause: ID's with custom characters (- , _ , etc.), were not linking correctly in the Markdown file when rendered in the browser because the ID in the respective destinies would be different than the one in anchor, while for IDs with only letters, the ID would be the same. Fix: It was suggested that to fix this bug, it should more or less like GitHub does it. While in gitea the anchors would be put in HTML like this: ``` <p dir="auto"><a href="#user-content-_toc152597800" rel="nofollow">Review</a></p> <p dir="auto"><a href="#user-content-_toc152597802" rel="nofollow">Staging</a></p> <p dir="auto"><a href="#user-content-_toc152597803" rel="nofollow">Development</a></p> <p dir="auto"><a href="#user-content-_toc152597828" rel="nofollow">Testing</a></p> <p dir="auto"><a href="#user-content-_toc152597829" rel="nofollow">Unit-tests</a></p> ``` In GitHub, the same anchor's href properties would be the same without "user-content-" trailing behind. So my code made sure to change those anchors, so it would not include "user-content-" and then add respective Event Listeners so it would scroll into the supposed places. Fixes: go-gitea#29196 --------- Co-authored-by: silverwind <me@silverwind.io>
Backport #29305 by @DanielMatiasCarvalho This seeks to fix the bug reported on issue #29196. Cause: ID's with custom characters (- , _ , etc.), were not linking correctly in the Markdown file when rendered in the browser because the ID in the respective destinies would be different than the one in anchor, while for IDs with only letters, the ID would be the same. Fix: It was suggested that to fix this bug, it should more or less like GitHub does it. While in gitea the anchors would be put in HTML like this: ``` <p dir="auto"><a href="#user-content-_toc152597800" rel="nofollow">Review</a></p> <p dir="auto"><a href="#user-content-_toc152597802" rel="nofollow">Staging</a></p> <p dir="auto"><a href="#user-content-_toc152597803" rel="nofollow">Development</a></p> <p dir="auto"><a href="#user-content-_toc152597828" rel="nofollow">Testing</a></p> <p dir="auto"><a href="#user-content-_toc152597829" rel="nofollow">Unit-tests</a></p> ``` In GitHub, the same anchor's href properties would be the same without "user-content-" trailing behind. So my code made sure to change those anchors, so it would not include "user-content-" and then add respective Event Listeners so it would scroll into the supposed places. Fixes: #29196 Co-authored-by: DC <106393991+DanielMatiasCarvalho@users.noreply.github.com> Co-authored-by: silverwind <me@silverwind.io>
Description
Hi.
I can't navigate through .md file in my repo, because all links in headers are converting from
readme.md#_toc152597800
toreadme.md#user-content-_toc152597800
and it breaks navigation through file.I read, that it was fixed in #11903 but I can reproduce it in my local instance and in public Gitea instance: https://try.gitea.io/wenofib626/user-content/src/branch/main/readme.md
Gitea Version
1.21.4
Can you reproduce the bug on the Gitea demo site?
Yes
Log Gist
No response
Screenshots
No response
Git Version
2.43.0
Operating System
linux
How are you running Gitea?
Self-hosted, systemd
Database
PostgreSQL
The text was updated successfully, but these errors were encountered: