From 01987c4c0838478a8fda81f427775f28476c5557 Mon Sep 17 00:00:00 2001 From: /bin/cat Date: Thu, 23 Apr 2026 02:40:27 +0800 Subject: [PATCH] fix(build): apply `base` to links with download attribute (#5186) --- src/node/markdown/plugins/link.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/node/markdown/plugins/link.ts b/src/node/markdown/plugins/link.ts index de5b564c7b4c..e606351e0a25 100644 --- a/src/node/markdown/plugins/link.ts +++ b/src/node/markdown/plugins/link.ts @@ -30,8 +30,6 @@ export const linkPlugin = ( const hrefIndex = token.attrIndex('href') if ( hrefIndex >= 0 && - token.attrIndex('target') < 0 && - token.attrIndex('download') < 0 && token.attrGet('class') !== 'header-anchor' // header anchors are already normalized ) { const hrefAttr = token.attrs![hrefIndex] @@ -54,6 +52,9 @@ export const linkPlugin = ( !url.startsWith('#') && // skip mail/custom protocol links protocol.startsWith('http') && + // skip links with target/download attribute as they are meant to be opened/downloaded as-is + token.attrIndex('target') < 0 && + token.attrIndex('download') < 0 && // skip links to files (other than html/md) treatAsHtml(pathname) ) {