From ee95e5fded36410f88ec40e462790fa4b0ad4052 Mon Sep 17 00:00:00 2001 From: Harlan Wilton Date: Thu, 3 Dec 2020 23:42:28 +1100 Subject: [PATCH] hf(md): avoid normalising markdown "mailto:" links The "mailto:" links were being normalised which resulted in them being linking to a broken URL and not working. --- src/node/markdown/plugins/link.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/node/markdown/plugins/link.ts b/src/node/markdown/plugins/link.ts index 4028b4eb..1e0bcbbb 100644 --- a/src/node/markdown/plugins/link.ts +++ b/src/node/markdown/plugins/link.ts @@ -23,7 +23,12 @@ export const linkPlugin = ( Object.entries(externalAttrs).forEach(([key, val]) => { token.attrSet(key, val) }) - } else if (!url.startsWith('#')) { + } else if ( + // internal anchor links + !url.startsWith('#') && + // mail links + !url.startsWith('mailto:') + ) { normalizeHref(hrefAttr) } }