sidebar chat: don't process inline latex in dollar signs

problematic with inline shell expressions
This commit is contained in:
end-4
2025-04-06 15:13:36 +02:00
parent f5d8467e42
commit 1b9717702b
+2 -2
View File
@@ -49,8 +49,8 @@ const replaceCategory = (text, replaces) => {
// Main function
export function replaceInlineLatexWithCodeBlocks(text) {
return text.replace(/\\\[(.*?)\\\]|\\\((.*?)\\\)|\$(.*?)\$/gs, (match, square, round, dollar) => {
const latex = square || round || dollar;
return text.replace(/\\\[(.*?)\\\]|\\\((.*?)\\\)/gs, (match, square, round) => {
const latex = square || round;
return `\n\`\`\`latex\n${latex}\n\`\`\`\n`;
});
}