-
-
Notifications
You must be signed in to change notification settings - Fork 5.9k
Description
Gitea Version
1.17.0+dev-92-g90b4d385d
Git Version
No response
Operating System
No response
How are you running Gitea?
confirmed on try.gitea.io + codeberg.org
Database
No response
Can you reproduce the bug on the Gitea demo site?
Yes
Log Gist
No response
Description
A user on Codeberg reported, that the auto-generated anchor links for headings in the Wiki apparently only work for Markdown. When using HTML headings in the wiki source, the rendered href attribute only contains "#".
Confirmed at https://try.gitea.io/fnetx/wikitesting/wiki/Home#.
Orignal report: https://codeberg.org/Codeberg/Community/issues/489
Normally a header within article is converted to an
<hX>
HTML tag containing an<a>
. Thehref
attribute would contain the header title shaped to be conformant as an URL string. Like this:
## Second-level heading
↓<h2 id="user-content-second-level-heading"> ← id attribute is present <a href="#second-level-heading"> ← anchor is in place Second-level heading </a> </h2>
However, if we’d use HTML markup in the source file, e.g. to put the heading at the centre, the href attribute will contain only the hash sign,
#
.<h2 align="center"> Second-level heading </h2>
↓
<h2 align="center"> ← id attribute is missing! <a href="#"> ← anchor is empty! Second-level heading </a> </h2>
It breaks cross-references between articles, making them much less useful, and breaks compatibility with at least Github, where it works.
Screenshots
No response
Activity
zeripath commentedon Feb 3, 2022
More interestingly the blob_excerpt links don't appear to work for the wiki. I've just noticed this and put up a PR to fix that #18587
zeripath commentedon Feb 3, 2022
@fnetX I've edited README.md to:
and it looks the same as the wiki content. I then added a
<h3 id="preset-id">This one has a preset id</h3>
and it gets the correct id.wxiaoguang commentedon Apr 26, 2023
It looks like this problem has been resolved?
fnetX commentedon May 4, 2023
To be honest, I don't quite understand how it is resolved. Are users supposed to set the id attribute manually for HTML headings? The auto-generated ones still appear to not work.
wxiaoguang commentedon May 4, 2023
There is reply above and no response for long time. So it's closed after it been marked as needs-feedback for a few days.
Put a sample from GitHub here:
https://github.com/wxiaoguang/playground/wiki
link: https://github.com/wxiaoguang/playground/wiki#------------second-level-heading----
Do you think this heading is acceptable?