From 2970b47e1d8d50d70b0266dfd160e48340dcc5e7 Mon Sep 17 00:00:00 2001 From: Maoayo233 Date: Thu, 23 Apr 2026 02:20:56 +0800 Subject: [PATCH] fix(build): apply `base` to links with download attribute --- 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 de5b564c7..e606351e0 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) ) {