From 5cecf6e17c68cc439763450fbaaa8378f552a87d Mon Sep 17 00:00:00 2001 From: MathMan05 Date: Wed, 10 Sep 2025 13:03:38 -0500 Subject: [PATCH] link markdown fixes --- src/webpage/markdown.ts | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/src/webpage/markdown.ts b/src/webpage/markdown.ts index eb9500a..6fb7286 100644 --- a/src/webpage/markdown.ts +++ b/src/webpage/markdown.ts @@ -757,12 +757,19 @@ class MarkDown { if (partsFound === 0 && txt[j] === "]") { if ( - txt[j + 1] === "(" && - txt[j + 2] === "h" && - txt[j + 3] === "t" && - txt[j + 4] === "t" && - txt[j + 5] === "p" && - (txt[j + 6] === "s" || txt[j + 6] === ":") + (txt[j + 1] === "(" && + txt[j + 2] === "h" && + txt[j + 3] === "t" && + txt[j + 4] === "t" && + txt[j + 5] === "p" && + (txt[j + 6] === "s" || txt[j + 6] === ":")) || + (txt[j + 1] === "(" && + txt[j + 2] === "<" && + txt[j + 3] === "h" && + txt[j + 4] === "t" && + txt[j + 5] === "t" && + txt[j + 6] === "p" && + (txt[j + 7] === "s" || txt[j + 7] === ":")) ) { partsFound++; } else { @@ -773,13 +780,15 @@ class MarkDown { break; } } - + console.warn(partsFound); if (partsFound === 2) { appendcurrent(); - const parts = build.join("").match(/^\[(.+)\]\((https?:.+?)( ('|").+('|"))?\)$/); + const parts = build.join("").match(/^\[(.+)\]\(?( ('|").+('|"))?\)$/); + console.warn(parts); if (parts) { const linkElem = document.createElement("a"); + if (URL.canParse(parts[2])) { i = j; MarkDown.safeLink(linkElem, parts[2]);