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/modules
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
activitypub Upgrade to golangci-lint@v1.55.0 (#27756) 1 year ago
analyze Rename code_langauge.go to code_language.go (#26377) 2 years ago
assetfs Use `Set[Type]` instead of `map[Type]bool/struct{}`. (#26804) 1 year ago
auth Next round of `db.DefaultContext` refactor (#27089) 1 year ago
avatar Remove nfnt/resize and oliamb/cutter (#25999) 2 years ago
base Refactor some legacy code and remove unused code (#28622) 1 year ago
cache Always enable caches (#28527) 1 year ago
charset Add option to disable ambiguous unicode characters detection (#28454) 1 year ago
container Implement FSFE REUSE for golang files (#21840) 2 years ago
context Move more functions to db.Find (#28419) 1 year ago
contexttest Replace assert.Fail with assert.FailNow (#27578) 1 year ago
csv Refactor locale number (#24134) 2 years ago
doctor Add orphaned topic consistency check (#28507) 1 year ago
emoji Update emoji set to Unicode 15 (#25595) 2 years ago
eventsource Final round of `db.DefaultContext` refactor (#27587) 1 year ago
generate Handle base64 decoding correctly to avoid panic (#26483) 1 year ago
git Integration Test for Commit Search containing Square Brackets (#28751) 1 year ago
gitgraph More `db.DefaultContext` refactor (#27265) 1 year ago
graceful Suggest to use Type=simple for systemd service (#28717) 1 year ago
hcaptcha Consume hcaptcha and pwn deps (#22610) 2 years ago
highlight Add option to disable ambiguous unicode characters detection (#28454) 1 year ago
hostmatcher Support allowed hosts for webhook to work with proxy (#27655) 1 year ago
html Refactor backend SVG package and add tests (#26335) 2 years ago
httpcache Less naked returns (#25713) 2 years ago
httplib Less naked returns (#25713) 2 years ago
indexer Add option to disable ambiguous unicode characters detection (#28454) 1 year ago
issue/template Replace `interface{}` with `any` (#25686) 2 years ago
json Replace `interface{}` with `any` (#25686) 2 years ago
label Make label templates have consistent behavior and priority (#23749) 2 years ago
lfs Do not set `Accept` header twice (#28598) 1 year ago
log Reduce some allocations in type conversion (#26772) 1 year ago
markup Rework markup link rendering (#26745) 1 year ago
mcaptcha Implement FSFE REUSE for golang files (#21840) 2 years ago
metrics Reduce usage of `db.DefaultContext` (#27073) 1 year ago
migration Replace `interface{}` with `any` (#25686) 2 years ago
nosql Update tool dependencies, lock govulncheck and actionlint (#25655) 2 years ago
options Use a general approach to access custom/static/builtin assets (#24022) 2 years ago
packages Support for grouping RPMs using paths (#26984) 1 year ago
paginator Use more specific test methods (#24265) 2 years ago
pprof Implement FSFE REUSE for golang files (#21840) 2 years ago
private Fix nil pointer panic when exec some gitea cli command (#28791) 1 year ago
process Replace assert.Fail with assert.FailNow (#27578) 1 year ago
proxy Use proxy for pull mirror (#22771) 2 years ago
proxyprotocol Implement FSFE REUSE for golang files (#21840) 2 years ago
public Refactor CORS handler (#28587) 1 year ago
queue Increase queue length (#27555) 1 year ago
recaptcha Implement FSFE REUSE for golang files (#21840) 2 years ago
references Make cross-reference issue links work in markdown documents again (#28682) 1 year ago
regexplru Upgrade go dependencies (#25819) 2 years ago
repository Move more functions to db.Find (#28419) 1 year ago
secret Improve decryption failure message (#24573) 2 years ago
session Next round of `db.DefaultContext` refactor (#27089) 1 year ago
setting Warn that `DISABLE_QUERY_AUTH_TOKEN` is false only if it's explicitly defined (#28783) 1 year ago
sitemap Fix sitemap (#22272) 2 years ago
ssh Remove SSH workaround (#27893) 1 year ago
storage Fix object storage path handling (#27024) 1 year ago
structs Add branch protection setting for ignoring stale approvals (#28498) 1 year ago
svg Refactor backend SVG package and add tests (#26335) 2 years ago
sync Implement FSFE REUSE for golang files (#21840) 2 years ago
system Replace more db.DefaultContext (#27628) 1 year ago
templates Rework markup link rendering (#26745) 1 year ago
test Move web/api context related testing function into a separate package (#26859) 1 year ago
testlogger Replace `interface{}` with `any` (#25686) 2 years ago
timeutil Make template `DateTime` show proper tooltip (#28677) 1 year ago
translation Replace `interface{}` with `any` (#25686) 2 years ago
turnstile Add new captcha: cloudflare turnstile (#22369) 2 years ago
typesniffer Detect ogg mime-type as audio or video (#26494) 1 year ago
updatechecker Replace more db.DefaultContext (#27628) 1 year ago
upload Implement FSFE REUSE for golang files (#21840) 2 years ago
uri Implement FSFE REUSE for golang files (#21840) 2 years ago
user Implement FSFE REUSE for golang files (#21840) 2 years ago
util Add option to disable ambiguous unicode characters detection (#28454) 1 year ago
validation Check blocklist for emails when adding them to account (#26812) 1 year ago
web Refactor CORS handler (#28587) 1 year ago
webhook Fix schedule tasks bugs (#28691) 1 year ago