mirror of
https://github.com/doocs/md.git
synced 2025-02-10 08:45:53 +08:00
feat: add case-insensitivity to alert type matching
This commit is contained in:
parent
c48f6419d3
commit
b9953ab2e7
@ -17,7 +17,7 @@ export default function markedAlert(options: AlertOptions = {}): MarkedExtension
|
||||
return
|
||||
|
||||
const matchedVariant = resolvedVariants.find(({ type }) =>
|
||||
new RegExp(createSyntaxPattern(type)).test(token.text),
|
||||
new RegExp(createSyntaxPattern(type), `i`).test(token.text),
|
||||
)
|
||||
|
||||
if (matchedVariant) {
|
||||
@ -148,7 +148,7 @@ export function resolveVariants(variants: AlertVariantItem[]) {
|
||||
* Returns regex pattern to match alert syntax.
|
||||
*/
|
||||
export function createSyntaxPattern(type: string) {
|
||||
return `^(?:\\[!${type.toUpperCase()}])\\s*?\n*`
|
||||
return `^(?:\\[!${type}])\\s*?\n*`
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user