Skip to content

Commit

Permalink
Perform text styling non-greedily and globally
Browse files Browse the repository at this point in the history
  • Loading branch information
desplesda committed Apr 3, 2024
1 parent 9b74ac7 commit 08d0b49
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/playground.ts
Original file line number Diff line number Diff line change
Expand Up @@ -479,8 +479,8 @@ function addLogText(text: string, ...classes : string[]) {

text = escape(text);

text = text.replace(/\[i\](.*)\[\/i\]/, (substring, group1) => `<i>${group1}</i>`)
text = text.replace(/\[b\](.*)\[\/b\]/, (substring, group1) => `<b>${group1}</b>`)
text = text.replace(/\[i\](.*?)\[\/i\]/g, (substring, group1) => `<i>${group1}</i>`)
text = text.replace(/\[b\](.*?)\[\/b\]/g, (substring, group1) => `<b>${group1}</b>`)

logElement.innerHTML = text;
return logElement;
Expand Down

0 comments on commit 08d0b49

Please sign in to comment.