From 18d18d2eb15a569113ca68ccbb9ba52dfd46c80a Mon Sep 17 00:00:00 2001 From: Harlan Wilton Date: Wed, 23 Dec 2020 21:43:47 +1100 Subject: [PATCH] fix(md): avoid normalising markdown "mailto:" links (#173) 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) } }