From d6063198111c3b658dc5ea980a1b1f5e9b93096b Mon Sep 17 00:00:00 2001
From: rackrick <45207681+rackrick@users.noreply.github.com>
Date: Wed, 13 Dec 2023 23:36:19 +0100
Subject: [PATCH] fix: add anchor to regex for special msg replacement (#1635)
---
src/plugins/helpers.ts | 17 ++++++++++++-----
1 file changed, 12 insertions(+), 5 deletions(-)
diff --git a/src/plugins/helpers.ts b/src/plugins/helpers.ts
index 7f4c89b31..0641ec209 100644
--- a/src/plugins/helpers.ts
+++ b/src/plugins/helpers.ts
@@ -62,13 +62,20 @@ export const camelize = (str: string): string => {
}
export function formatConsoleMessage(message: string): string {
- message = message.replace(/!! /g, '')
- message = message.replace(/\/\/ /g, '')
+ // remove !! at error msg start
+ message = message.replace(/^!! /g, '')
+ // remove !! after \n new line
+ message = message.replace(/\n!! /g, '\n')
+ // remove // at command msg start
+ message = message.replace(/^\/\/ /g, '')
+ // remove // at \n new line
+ message = message.replace(/\n\/\/ /g, '\n')
+ // remove echo
+ message = message.replace(/^echo:/g, '')
+ message = message.replace(/^echo: /g, '')
+ // replace linebreaks with html
message = message.replace('\n// ', '
')
message = message.replace(/\r\n|\r|\n/g, '
')
- //message = message.replaceAll('
', '
')
- //return message.split('
');
-
return message
}