From d6801975a0aee227c9e770c5ac566910371b914f Mon Sep 17 00:00:00 2001 From: Halsey1006 Date: Mon, 24 Apr 2023 17:50:42 -0700 Subject: [PATCH] Rewrote quote recolor regex Found some more issues with quote recoloring, particularly in relation to numbered lists. Tested this change a bit more thoroughly, including multiple sets of backtick-enclosed quote marks on the same line, all seems to be working properly now. --- public/script.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/public/script.js b/public/script.js index 3583db1c1..3da42b3fd 100644 --- a/public/script.js +++ b/public/script.js @@ -878,14 +878,17 @@ function messageFormating(mes, ch_name, isSystem, forceAvatar) { .replace(/\*\*(.+?)\*\*/g, "$1") .replace(/\n/g, "
"); } else if (!isSystem) { + mes = mes.replace(/```[\s\S]*?```|``[\s\S]*?``|`[\s\S]*?`|(\".+?\")/gm, function(match, p1) { + if (p1) { + return "" + p1.replace(/\"/g, "") + ""; + } else { + return match; + } + }); mes = converter.makeHtml(mes); //mes = mes.replace(/{.*}/g, ""); mes = mes.replace(/{{(\*?.+?\*?)}}/g, ""); - - mes = mes.replace(/(]*>[\s\S]*?<\/code>)|\"(.+?)\"/g, function (match, code, quote) { - return code ? code : `${quote}`; - }); mes = mes.replace(/\n/g, "
"); mes = mes.trim();