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) ) {