From af7f04cdaaf9c6514b0aa2d318922d585f51e692 Mon Sep 17 00:00:00 2001 From: sophiamersmann Date: Fri, 13 Oct 2023 13:58:03 +0000 Subject: [PATCH] fix(url-parser): allow ':' in urls --- packages/@ourworldindata/utils/src/MarkdownTextWrap/parser.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/@ourworldindata/utils/src/MarkdownTextWrap/parser.ts b/packages/@ourworldindata/utils/src/MarkdownTextWrap/parser.ts index d1d5cdd1cac..9ea79b74636 100644 --- a/packages/@ourworldindata/utils/src/MarkdownTextWrap/parser.ts +++ b/packages/@ourworldindata/utils/src/MarkdownTextWrap/parser.ts @@ -249,7 +249,7 @@ const plainUrlParser = (): P.Parser => // https://urlregex.com const urlRegex = - /((([A-Za-z]{3,9}:(?:\/\/)?)(?:[\-;:&=\+\$,\w]+@)?[A-Za-z0-9\.\-]+|(?:www\.|[\-;:&=\+\$,\w]+@)[A-Za-z0-9\.\-]+)((?:\/[\+~%\/\.\w\-_]*)?\??(?:[\-\+=&;%@~\.\w_]*)#?(?:[\.\!\/\\\w\-]*))?)/ + /((([A-Za-z]{3,9}:(?:\/\/)?)(?:[\-;:&=\+\$,\w]+@)?[A-Za-z0-9\.\-]+|(?:www\.|[\-;:&=\+\$,\w]+@)[A-Za-z0-9\.\-]+)((?:\/[\+~:%\/\.\w\-_]*)?\??(?:[\-\+=&;%@~:\.\w_]*)#?(?:[\.\!\/\\\w\-]*))?)/ const nonBracketWordParser: (r: MdParser) => P.Parser = () => P.regex(/[^\[\]\s]+/).map((val) => ({ type: "text", value: val })) // no brackets, no WS