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