fix(plugin-shikiji): incorrect render when whitespace:true, close #444 (#446)

This commit is contained in:
pengzhanbo 2025-01-21 12:00:38 +08:00 committed by GitHub
parent 363a0dd425
commit 30d1c046ff
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -8,11 +8,11 @@ export function resolveWhitespacePosition(info: string, defaultPosition?: boolea
return false return false
} }
defaultPosition = defaultPosition === true ? undefined : defaultPosition const position = defaultPosition === true ? undefined : defaultPosition
const match = info.match(WHITESPACE_REGEXP) const match = info.match(WHITESPACE_REGEXP)
if (match) { if (match) {
return (match[1] || defaultPosition || 'all') as WhitespacePosition return (match[1] || position || 'all') as WhitespacePosition
} }
return defaultPosition ?? false return defaultPosition === true ? 'all' : defaultPosition ?? false
} }