Skip to content

user-content- prefix of user-generated IDs in markup breaks anchored links between files or wiki pages #12062

Closed
@AnneLaureF

Description

@AnneLaureF

Description

Since #9477 the web interface adds a "user-content-" prefix to IDs in markup files.
The internal links [link to internal anchor](#my-anchor) are correctly updated with the prefix, but links to an anchor of another file are not. This makes the link point to a non existing ID and navigation ends up at the top of the other page.

This breaks navigation between long markup files.
Tested with markdown files in repository, and in the wiki pages, as you can see in the test repo https://try.gitea.io/annelauref/TEST_prefix_ID

I think a solution would be to add the prefix to anchors in relative links.

Edited to say: manually adding user-content- to links between file could be a workaround for some repos but it is confusing (needed for some links but no all) and breaks compatibility with at least Github (for me it's happening on a repo that has multiple remotes, one on an internal Gitea server and one on Github)

Screenshots

As you can see in this image, this link is not rewritten:
image

But the anchor in the other file is rewritten:
image

Metadata

Metadata

Assignees

No one assigned

    Labels

    topic/uiChange the appearance of the Gitea UI

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions