You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
gitea/services
KN4CK3R 637451a45e
Rework markup link rendering (#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>

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
1 year ago
..
actions Fix schedule tasks bugs (#28691) 1 year ago
agit Adjust object format interface (#28469) 1 year ago
asymkey Move more functions to db.Find (#28419) 1 year ago
attachment Even more `db.DefaultContext` refactor (#27352) 1 year ago
auth Refactor timeutil package (#28623) 1 year ago
automerge Improve queue and logger context (#24924) 2 years ago
context Another round of `db.DefaultContext` refactor (#27103) 1 year ago
convert Add branch protection setting for ignoring stale approvals (#28498) 1 year ago
cron Update go dependencies (#28518) 1 year ago
externalaccount Final round of `db.DefaultContext` refactor (#27587) 1 year ago
feed More `db.DefaultContext` refactor (#27265) 1 year ago
forms Add branch protection setting for ignoring stale approvals (#28498) 1 year ago
gitdiff Add option to disable ambiguous unicode characters detection (#28454) 1 year ago
indexer Fix missing issue search index update when changing status (#28325) 1 year ago
issue Remove deadcode under models/issues (#28536) 1 year ago
lfs Remove GetByBean method because sometimes it's danger when query condition parameter is zero and also introduce new generic methods (#28220) 1 year ago
mailer Rework markup link rendering (#26745) 1 year ago
markup make writing main test easier (#27270) 1 year ago
migrations Move more functions to db.Find (#28419) 1 year ago
mirror Refactor deletion (#28610) 1 year ago
notify Update status and code index after changing the default branch (#27018) 1 year ago
org Delete repos of org when purge delete user (#27273) 1 year ago
packages Support for grouping RPMs using paths (#26984) 1 year ago
pull Concatenate error in `checkIfPRContentChanged` (#28731) 1 year ago
release Refactor deletion (#28610) 1 year ago
repository Move more functions to db.Find (#28419) 1 year ago
secrets Refactor deletion (#28610) 1 year ago
task Fix incorrect ctx usage in defer function (#27740) 1 year ago
uinotification Penultimate round of `db.DefaultContext` refactor (#27414) 1 year ago
user Forbid removing the last admin user (#28337) 1 year ago
webhook Abstract hash function usage (#28138) 1 year ago
wiki Fix schedule tasks bugs (#28691) 1 year ago