Files
Gitea/modules/markup/html_commit.go
silverwind 0e99932530 Only turn links to current instance into hash links (#36237)
Given the following markdown:

```
a832c723cd
19fe6cdf81
a832c723cd
```

Previously, all links would turn into hash link, even ones to external
sites:

<img width="849" height="89" alt="Screenshot 2025-12-23 at 19 19 13"
src="https://github.com/user-attachments/assets/2ad35a18-4542-40a4-a838-7ab8ac8bc047"
/>

After this change, only links to the current instance, as identified by
`setting.AppURL` are turned into hash links:

<img width="850" height="87" alt="Screenshot 2025-12-23 at 19 18 56"
src="https://github.com/user-attachments/assets/2c49a5b2-426c-4a82-a610-9b9da8dcfff9"
/>

There is still one notable [difference with
GitHub](https://github.com/silverwind/symlink-test/issues/20#issuecomment-3687535938)
where the second link should render like `user/repo@<hash>`, not
`<hash>` as currently, I would like to fix that here as well.

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-16 10:27:49 +00:00

6.2 KiB