From 46e22d175645f75bce5356c5a9bfc71fc401a365 Mon Sep 17 00:00:00 2001 From: Simon Cambier Date: Mon, 20 Feb 2023 17:35:09 +0100 Subject: [PATCH] #195 - Fixed issue where $1 & $2 were shown as-is in case of no content to replace --- src/tools/utils.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/tools/utils.ts b/src/tools/utils.ts index 00e0666..9254408 100644 --- a/src/tools/utils.ts +++ b/src/tools/utils.ts @@ -26,7 +26,11 @@ export function highlighter(str: string): string { return `${str}` } -export const highlighterGroups = `$1$2` +export function highlighterGroups(...args: any[]) { + if (args[1] && args[2]) + return `${args[1]}${args[2]}` + return '<no content>' +} export function escapeHTML(html: string): string { return html