Skip to content

Commit

Permalink
fix: add anchor to regex for special msg replacement (#1635)
Browse files Browse the repository at this point in the history
  • Loading branch information
rackrick authored Dec 13, 2023
1 parent af959d1 commit d606319
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions src/plugins/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 <br>
message = message.replace('\n// ', '<br>')
message = message.replace(/\r\n|\r|\n/g, '<br>')
//message = message.replaceAll('<br />', '<br>')
//return message.split('<br>');

return message
}

Expand Down

0 comments on commit d606319

Please sign in to comment.