refactor: fix regex pattern for markdown-wiki-links plugin

This commit is contained in:
purocean
2024-06-15 01:19:48 +08:00
parent f2018cd829
commit 89128087bf
+2 -2
View File
@@ -1,7 +1,7 @@
import { Plugin } from '@fe/context'
import type StateInline from 'markdown-it/lib/rules_inline/state_inline'
const reMatch = /^\s*([^[#|]+)(?:#([^|]*))?(?:\|([^\]]*))?\s*$/
const reMatch = /^\s*([^[#|]*)?(?:#([^|]*))?(?:\|([^\]]*))?\s*$/
const reExternalLink = /^[a-zA-Z]{1,8}:\/\/.*/
const reExtName = /\.[^/]+$/
@@ -22,7 +22,7 @@ function wikiLinks (state: StateInline, silent?: boolean) {
return false
}
const link = parts[1].trim()
const link = (parts[1] || '').trim()
const hash = parts[2] || ''
const label = parts[3] || ''