From db28962b4bfb3059e70d1eb55ab6d11043689559 Mon Sep 17 00:00:00 2001 From: Patrick Stainbrook Date: Wed, 1 Nov 2023 22:45:16 +0100 Subject: [PATCH 1/5] fix: add anchor to regex for error msg replacement Signed-off-by: Patrick Stainbrook --- src/plugins/helpers.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/helpers.ts b/src/plugins/helpers.ts index 7f4c89b31..813c8bf2e 100644 --- a/src/plugins/helpers.ts +++ b/src/plugins/helpers.ts @@ -62,7 +62,7 @@ export const camelize = (str: string): string => { } export function formatConsoleMessage(message: string): string { - message = message.replace(/!! /g, '') + message = message.replace(/^!! /g, '') message = message.replace(/\/\/ /g, '') message = message.replace('\n// ', '
') message = message.replace(/\r\n|\r|\n/g, '
') From c3a7b1af2fe249685faf70a27742b17c4222001d Mon Sep 17 00:00:00 2001 From: Patrick Stainbrook Date: Thu, 2 Nov 2023 00:22:13 +0100 Subject: [PATCH 2/5] fix: multiline replacment for special chars Signed-off-by: Patrick Stainbrook --- src/plugins/helpers.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/plugins/helpers.ts b/src/plugins/helpers.ts index 813c8bf2e..8e0867f30 100644 --- a/src/plugins/helpers.ts +++ b/src/plugins/helpers.ts @@ -63,7 +63,9 @@ export const camelize = (str: string): string => { export function formatConsoleMessage(message: string): string { message = message.replace(/^!! /g, '') - message = message.replace(/\/\/ /g, '') + message = message.replace(/\n!! /g, '\n') + message = message.replace(/^\/\/ /g, '') + message = message.replace(/\n\/\/ /g, '\n') message = message.replace('\n// ', '
') message = message.replace(/\r\n|\r|\n/g, '
') //message = message.replaceAll('
', '
') From 14d97f280820d966724a081bdaa9c1f744824c91 Mon Sep 17 00:00:00 2001 From: Patrick Stainbrook Date: Thu, 2 Nov 2023 00:23:18 +0100 Subject: [PATCH 3/5] refactor: remove commented code Signed-off-by: Patrick Stainbrook --- src/plugins/helpers.ts | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/plugins/helpers.ts b/src/plugins/helpers.ts index 8e0867f30..c7c10f7d4 100644 --- a/src/plugins/helpers.ts +++ b/src/plugins/helpers.ts @@ -68,9 +68,6 @@ export function formatConsoleMessage(message: string): string { message = message.replace(/\n\/\/ /g, '\n') message = message.replace('\n// ', '
') message = message.replace(/\r\n|\r|\n/g, '
') - //message = message.replaceAll('
', '
') - //return message.split('
'); - return message } From a96d6d7cff927ad11bacfecd1d4c9b4468a18aa7 Mon Sep 17 00:00:00 2001 From: Patrick Stainbrook Date: Thu, 2 Nov 2023 00:24:51 +0100 Subject: [PATCH 4/5] doc: regex description Signed-off-by: Patrick Stainbrook --- src/plugins/helpers.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/plugins/helpers.ts b/src/plugins/helpers.ts index c7c10f7d4..5d0dab248 100644 --- a/src/plugins/helpers.ts +++ b/src/plugins/helpers.ts @@ -62,10 +62,15 @@ export const camelize = (str: string): string => { } export function formatConsoleMessage(message: string): string { + // 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') + // replace linebreaks with html
message = message.replace('\n// ', '
') message = message.replace(/\r\n|\r|\n/g, '
') return message From cc8ff26279916a7e5fe10cb7bd024b41cee13c9b Mon Sep 17 00:00:00 2001 From: Patrick Stainbrook Date: Thu, 2 Nov 2023 23:21:45 +0100 Subject: [PATCH 5/5] fix: remove echo from console msgs Signed-off-by: Patrick Stainbrook --- src/plugins/helpers.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/plugins/helpers.ts b/src/plugins/helpers.ts index 5d0dab248..0641ec209 100644 --- a/src/plugins/helpers.ts +++ b/src/plugins/helpers.ts @@ -70,6 +70,9 @@ export function formatConsoleMessage(message: string): string { 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, '
')