0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo.git synced 2025-03-12 22:51:44 -05:00
forgejo/modules
KN4CK3R 875b398e5e
Rework markup link rendering (#26745) (#28803)
Backport #26745
Fixes #26548

This PR refactors the rendering of markup links. The old code uses
`strings.Replace` to change some urls while the new code uses more
context to decide which link should be generated.

The added tests should ensure the same output for the old and new
behaviour (besides the bug).

We may need to refactor the rendering a bit more to make it clear how
the different helper methods render the input string. There are lots of
options (resolve links / images / mentions / git hashes / emojis / ...)
but you don't really know what helper uses which options. For example,
we currently support images in the user description which should not be
allowed I think:

<details>
  <summary>Profile</summary>

https://try.gitea.io/KN4CK3R

![grafik](https://github.com/go-gitea/gitea/assets/1666336/109ae422-496d-4200-b52e-b3a528f553e5)

</details>

(cherry picked from commit 022552d5b6)
2024-01-16 14:41:11 +00:00
..
actions [ACTIONS] on.schedule: the event is always "schedule" 2023-12-23 15:58:37 +01:00
activitypub
analyze
assetfs
auth [GITEA] Drop sha256-simd in favor of stdlib 2023-11-13 14:06:31 +01:00
avatar [GITEA] Drop sha256-simd in favor of stdlib 2023-11-13 14:06:31 +01:00
base [GITEA] Drop sha256-simd in favor of stdlib 2023-11-13 14:06:31 +01:00
cache
charset Add option to disable ambiguous unicode characters detection (#28454) (#28499) 2023-12-22 12:07:01 +01:00
container
context [GITEA] rework long-term authentication 2024-01-16 14:14:46 +00:00
contexttest
csv
doctor Initalize stroage for orphaned repository doctor (#28487) (#28490) 2023-12-22 12:05:11 +01:00
emoji
eventsource
generate
git Add -F to commit search to treat keywords as strings (#28744) (#28748) 2024-01-16 14:39:23 +00:00
gitgraph
graceful
hcaptcha
highlight Add option to disable ambiguous unicode characters detection (#28454) (#28499) 2023-12-22 12:07:01 +01:00
hostmatcher
html
httpcache [BRANDING] add X-Forgejo-* headers 2023-11-13 13:58:18 +01:00
httplib
indexer Add option to disable ambiguous unicode characters detection (#28454) (#28499) 2023-12-22 12:07:01 +01:00
issue/template
json
label
lfs [GITEA] Drop sha256-simd in favor of stdlib 2023-11-13 14:06:31 +01:00
log
markup Rework markup link rendering (#26745) (#28803) 2024-01-16 14:41:11 +00:00
mcaptcha
metrics
migration
nosql
options
packages
paginator
pprof
private Use correct has error check for internal responses (#28796) (#28798) 2024-01-16 14:40:56 +00:00
process
proxy
proxyprotocol
public Refactor CORS handler (#28587) (#28611) 2024-01-16 14:08:38 +00:00
queue
recaptcha
references
regexplru
repository Ignore "non-existing" errors when getDirectorySize calculates the size (#28276) (#28285) 2023-12-08 13:41:16 +01:00
secret [GITEA] Drop sha256-simd in favor of stdlib 2023-11-13 14:06:31 +01:00
session
setting Fix panic when parsing empty pgsql host (#28708) (#28709) 2024-01-16 14:16:56 +00:00
sitemap
ssh [GITEA] Remove SSH workaround 2023-11-13 14:06:31 +01:00
storage
structs [ACTIONS] on.schedule: create a new payload 2023-12-23 15:58:37 +01:00
svg
sync
system
templates Rework markup link rendering (#26745) (#28803) 2024-01-16 14:41:11 +00:00
test
testlogger
timeutil Make template DateTime show proper tooltip (#28677) (#28683) 2024-01-16 14:16:55 +00:00
translation
turnstile
typesniffer
updatechecker
upload
uri
user
util [GITEA] rework long-term authentication 2024-01-16 14:14:46 +00:00
validation [GITEA] add option for banning dots in usernames 2023-11-13 14:04:16 +01:00
web [GITEA] Use maintained gziphandler 2024-01-16 14:09:55 +00:00
webhook [ACTIONS] on.schedule: the event is always "schedule" 2023-12-23 15:58:37 +01:00