mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Allow double quotes inside of <tags>
This commit is contained in:
@ -1584,6 +1584,13 @@ function messageFormatting(mes, ch_name, isSystem, isUser) {
|
|||||||
.replace(/\*\*(.+?)\*\*/g, '<b>$1</b>')
|
.replace(/\*\*(.+?)\*\*/g, '<b>$1</b>')
|
||||||
.replace(/\n/g, '<br/>');
|
.replace(/\n/g, '<br/>');
|
||||||
} else if (!isSystem) {
|
} else if (!isSystem) {
|
||||||
|
// Save double quotes in tags as a special character to prevent them from being encoded
|
||||||
|
if (!power_user.encode_tags) {
|
||||||
|
mes = mes.replace(/<([^>]+)>/g, function(_, contents){
|
||||||
|
return '<' + contents.replace(/"/g, '\ufffe') + '>';
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
mes = mes.replace(/```[\s\S]*?```|``[\s\S]*?``|`[\s\S]*?`|(".+?")|(\u201C.+?\u201D)/gm, function (match, p1, p2) {
|
mes = mes.replace(/```[\s\S]*?```|``[\s\S]*?``|`[\s\S]*?`|(".+?")|(\u201C.+?\u201D)/gm, function (match, p1, p2) {
|
||||||
if (p1) {
|
if (p1) {
|
||||||
return '<q>"' + p1.replace(/"/g, '') + '"</q>';
|
return '<q>"' + p1.replace(/"/g, '') + '"</q>';
|
||||||
@ -1594,6 +1601,11 @@ function messageFormatting(mes, ch_name, isSystem, isUser) {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Restore double quotes in tags
|
||||||
|
if (!power_user.encode_tags) {
|
||||||
|
mes = mes.replace(/\ufffe/g, '"');
|
||||||
|
}
|
||||||
|
|
||||||
mes = mes.replaceAll('\\begin{align*}', '$$');
|
mes = mes.replaceAll('\\begin{align*}', '$$');
|
||||||
mes = mes.replaceAll('\\end{align*}', '$$');
|
mes = mes.replaceAll('\\end{align*}', '$$');
|
||||||
mes = converter.makeHtml(mes);
|
mes = converter.makeHtml(mes);
|
||||||
|
Reference in New Issue
Block a user