Skip to content

Commit

Permalink
feat: add case-insensitivity to alert type matching
Browse files Browse the repository at this point in the history
  • Loading branch information
dribble-njr committed Nov 21, 2024
1 parent c48f641 commit b9953ab
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/utils/MDAlert.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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*`
}

/**
Expand Down

0 comments on commit b9953ab

Please sign in to comment.