From 53517e2949a8d0b983daecc056b1563b6bf7c19c Mon Sep 17 00:00:00 2001 From: Anthony Fu Date: Sun, 21 Jan 2024 16:46:19 +0100 Subject: [PATCH] chore: update regexp --- src/node/markdown/plugins/githubAlerts.ts | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/src/node/markdown/plugins/githubAlerts.ts b/src/node/markdown/plugins/githubAlerts.ts index 853a83bd..73efadf9 100644 --- a/src/node/markdown/plugins/githubAlerts.ts +++ b/src/node/markdown/plugins/githubAlerts.ts @@ -5,16 +5,6 @@ export const gitHubAlertsPlugin = ( md: MarkdownIt, options?: ContainerOptions ) => { - const markers = [ - 'TIP', - 'NOTE', - 'INFO', - 'IMPORTANT', - 'WARNING', - 'CAUTION', - 'DANGER' - ] - const matchCaseSensitive = true const titleMark = { tip: options?.tipLabel || 'TIP', note: options?.noteLabel || 'NOTE', @@ -25,11 +15,7 @@ export const gitHubAlertsPlugin = ( danger: options?.dangerLabel || 'DANGER' } as Record - const markerNameRE = markers.join('|') - const RE = new RegExp( - `^\\[\\!(${markerNameRE})\\]([^\\n\\r]*)`, - matchCaseSensitive ? '' : 'i' - ) + const RE = /^\[\!(TIP|NOTE|INFO|IMPORTANT|WARNING|CAUTION|DANGER)\]([^\n\r]*)/i md.core.ruler.after('block', 'github-alerts', (state) => { const tokens = state.tokens