From ca365d0b38d6a6705eebf0e3463cc4dd085b80d5 Mon Sep 17 00:00:00 2001 From: Gnohz Gniy <0x00eeee@gmail.com> Date: Mon, 25 Nov 2024 19:10:52 +0800 Subject: [PATCH] More error-tolerant link matching (#777) --- CoreEditor/src/styling/nodes/link.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CoreEditor/src/styling/nodes/link.ts b/CoreEditor/src/styling/nodes/link.ts index b476e743..8ceece5a 100644 --- a/CoreEditor/src/styling/nodes/link.ts +++ b/CoreEditor/src/styling/nodes/link.ts @@ -4,7 +4,7 @@ import { isReleaseMode } from '../../common/utils'; import { isMetaKeyDown } from '../../modules/events'; // Fragile approach, but we only use it for link clicking, it should be fine -const regexp = /[a-zA-Z][a-zA-Z0-9+.-]*:\/\/\/?(www\.)?[-a-zA-Z0-9@:%._+~#=]{1,256}(\.)?[a-z]{2,16}\b([-a-zA-Z0-9@:%_+.~#?&//=]*)|(\[.*?\]\()(.+?)[\s)]/g; +const regexp = /[a-zA-Z][a-zA-Z0-9+.-]*:\/\/\/?([a-zA-Z0-9-]+\.)?[-a-zA-Z0-9@:%._+~#=]+(\.[a-z]+)?\b([-a-zA-Z0-9@:%._+~#=?&//]*)|(\[.*?\]\()(.+?)[\s)]/g; const className = 'cm-md-link'; declare global {