chore: update regexp

pull/3482/head
Anthony Fu 2 years ago
parent f782fe4f7e
commit 53517e2949

@ -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<string, string>
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

Loading…
Cancel
Save