mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-10-29 04:22:24 -05:00
feat: Relax URL matching (#3925)
* feat: Relax URL matching Instead of only linkifying things with an explicit http or https scheme, the xurls.Relaxed also matches links with known TLDs. This means that text like 'banana.com' will also be matched, despite the missing http/https scheme. This also works to linkify email addresses, which is handy. This should also ensure we catch links without a scheme for the purpose of spam checking.
This commit is contained in:
parent
27171a78de
commit
1bf40e755c
4 changed files with 7 additions and 13 deletions
|
|
@ -139,7 +139,7 @@ func (f *Formatter) fromMarkdown(
|
|||
},
|
||||
// Turns URLs into links.
|
||||
extension.NewLinkify(
|
||||
extension.WithLinkifyURLRegexp(regexes.LinkScheme),
|
||||
extension.WithLinkifyURLRegexp(regexes.URLLike),
|
||||
),
|
||||
extension.Strikethrough,
|
||||
),
|
||||
|
|
|
|||
|
|
@ -168,7 +168,7 @@ func (f *Formatter) fromPlain(
|
|||
},
|
||||
// Turns URLs into links.
|
||||
extension.NewLinkify(
|
||||
extension.WithLinkifyURLRegexp(regexes.LinkScheme),
|
||||
extension.WithLinkifyURLRegexp(regexes.URLLike),
|
||||
),
|
||||
),
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue