From 1bf40e755c897dfedcfa1b54a5598475b99099d4 Mon Sep 17 00:00:00 2001 From: Daenney Date: Mon, 24 Mar 2025 14:13:32 +0100 Subject: 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. --- internal/text/plain.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'internal/text/plain.go') diff --git a/internal/text/plain.go b/internal/text/plain.go index ee4947bf7..17e2800ec 100644 --- a/internal/text/plain.go +++ b/internal/text/plain.go @@ -168,7 +168,7 @@ func (f *Formatter) fromPlain( }, // Turns URLs into links. extension.NewLinkify( - extension.WithLinkifyURLRegexp(regexes.LinkScheme), + extension.WithLinkifyURLRegexp(regexes.URLLike), ), ), ) -- cgit v1.2.3