From 012bca112eec898188b0bd56d6ef82d95d31e21f Mon Sep 17 00:00:00 2001 From: Halsey1006 Date: Sun, 7 May 2023 02:11:14 -0700 Subject: [PATCH] Updated quote tagging Quote tagging now works with left and right side specific quote mark characters as well. --- public/script.js | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/public/script.js b/public/script.js index 33bbfbc1d..cd5876d08 100644 --- a/public/script.js +++ b/public/script.js @@ -961,13 +961,15 @@ function messageFormatting(mes, ch_name, isSystem, isUser) { .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 = mes.replace(/```[\s\S]*?```|``[\s\S]*?``|`[\s\S]*?`|(\".+?\")|(\u201C.+?\u201D)/gm, function (match, p1, p2) { + if (p1) { + return '"' + p1.replace(/\"/g, "") + '"'; + } else if (p2) { + return '“' + p2.replace(/\u201C|\u201D/g, "") + '”'; + } else { + return match; + } + }); mes = mes.replaceAll('\\begin{align*}', '$$'); mes = mes.replaceAll('\\end{align*}', '$$'); mes = converter.makeHtml(mes);