fix(document): apply the email boundary to all link patterns

This commit is contained in:
joshjyu
2026-08-28 09:21:32 -07:00
parent e8209b891d
commit 5cdff1319b
@@ -1782,7 +1782,7 @@ export class DocumentInterpreter {
// appear as visible text — and those are usually written without a scheme. Match
// three shapes: full http(s) URLs, "www."-prefixed hosts, and bare domains with a
// recognizable TLD. The last two get "https://" prepended so the output is usable.
const urlPattern = /(?:https?:\/\/|www\.)[^\s<>"')\]]+|(?<![@\w.-])(?:[a-z0-9-]+\.)+(?:com|org|net|io|dev|ai|app|co|edu|gov|us|info)\b(?!\.[a-z])(?:\/[^\s<>"')\]]*)?/gi;
const urlPattern = /(?<![@\w.-])(?:(?:https?:\/\/|www\.)[^\s<>"')\]]+|(?:[a-z0-9-]+\.)+(?:com|org|net|io|dev|ai|app|co|edu|gov|us|info)\b(?!\.[a-z])(?:\/[^\s<>"')\]]*)?)/gi;
const raw = text.match(urlPattern) || [];
const htmlLinks = sourceHtml
? Array.from(sourceHtml.matchAll(/href\s*=\s*["']([^"']+)["']/gi))