|
@ -443,19 +443,21 @@ function ensureCachedRegex(ref: CacheableAutolinkReference, outputFormat: 'html' |
|
|
if (outputFormat === 'markdown' && ref.messageMarkdownRegex == null) { |
|
|
if (outputFormat === 'markdown' && ref.messageMarkdownRegex == null) { |
|
|
// Extra `\\\\` in `\\\\\\[` is because the markdown is escaped
|
|
|
// Extra `\\\\` in `\\\\\\[` is because the markdown is escaped
|
|
|
ref.messageMarkdownRegex = new RegExp( |
|
|
ref.messageMarkdownRegex = new RegExp( |
|
|
`(?<=^|\\s|\\(|\\\\\\[)(${escapeRegex(encodeHtmlWeak(escapeMarkdown(ref.prefix)))}(${ |
|
|
|
|
|
|
|
|
`(?<=^|\\s|\\(|\\[|\\{)(${escapeRegex(encodeHtmlWeak(escapeMarkdown(ref.prefix)))}(${ |
|
|
ref.alphanumeric ? '\\w' : '\\d' |
|
|
ref.alphanumeric ? '\\w' : '\\d' |
|
|
}+))\\b`,
|
|
|
}+))\\b`,
|
|
|
ref.ignoreCase ? 'gi' : 'g', |
|
|
ref.ignoreCase ? 'gi' : 'g', |
|
|
); |
|
|
); |
|
|
} else if (outputFormat === 'html' && ref.messageHtmlRegex == null) { |
|
|
} else if (outputFormat === 'html' && ref.messageHtmlRegex == null) { |
|
|
ref.messageHtmlRegex = new RegExp( |
|
|
ref.messageHtmlRegex = new RegExp( |
|
|
`(?<=^|\\s|\\(|\\[)(${escapeRegex(encodeHtmlWeak(ref.prefix))}(${ref.alphanumeric ? '\\w' : '\\d'}+))\\b`, |
|
|
|
|
|
|
|
|
`(?<=^|\\s|\\(|\\[|\\{)(${escapeRegex(encodeHtmlWeak(ref.prefix))}(${ |
|
|
|
|
|
ref.alphanumeric ? '\\w' : '\\d' |
|
|
|
|
|
}+))\\b`,
|
|
|
ref.ignoreCase ? 'gi' : 'g', |
|
|
ref.ignoreCase ? 'gi' : 'g', |
|
|
); |
|
|
); |
|
|
} else if (ref.messageRegex == null) { |
|
|
} else if (ref.messageRegex == null) { |
|
|
ref.messageRegex = new RegExp( |
|
|
ref.messageRegex = new RegExp( |
|
|
`(?<=^|\\s|\\(|\\[)(${escapeRegex(ref.prefix)}(${ref.alphanumeric ? '\\w' : '\\d'}+))\\b`, |
|
|
|
|
|
|
|
|
`(?<=^|\\s|\\(|\\[|\\{)(${escapeRegex(ref.prefix)}(${ref.alphanumeric ? '\\w' : '\\d'}+))\\b`, |
|
|
ref.ignoreCase ? 'gi' : 'g', |
|
|
ref.ignoreCase ? 'gi' : 'g', |
|
|
); |
|
|
); |
|
|
} |
|
|
} |
|
|