#195 - Fixed issue where $1 & $2 were shown as-is in case of no content to replace

This commit is contained in:
Simon Cambier
2023-02-20 17:35:09 +01:00
parent c70e446e84
commit 46e22d1756

View File

@@ -26,7 +26,11 @@ export function highlighter(str: string): string {
return `<span class="${highlightClass}">${str}</span>`
}
export const highlighterGroups = `$1<span class="${highlightClass}">$2</span>`
export function highlighterGroups(...args: any[]) {
if (args[1] && args[2])
return `${args[1]}<span class="${highlightClass}">${args[2]}</span>`
return '&lt;no content&gt;'
}
export function escapeHTML(html: string): string {
return html