fix(build): apply `base` to links with download attribute

pull/5186/head
Maoayo233 3 months ago
parent c608981324
commit 2970b47e1d
No known key found for this signature in database

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

Loading…
Cancel
Save