|
|
@@ -138,7 +138,8 @@ function processDelimiter(html, left, right, displayMode) {
|
|
|
}
|
|
|
|
|
|
// 【修复】处理公式内的换行符:将 \n 替换成空格,避免破坏公式
|
|
|
- cleanLatex = cleanLatex.replace(/\\n/g, ' ').replace(/\n/g, ' ');
|
|
|
+ // 使用负向前瞻 (?![a-zA-Z]) 避免误伤 LaTeX 命令如 \neq, \ne, \newline, \nu 等
|
|
|
+ cleanLatex = cleanLatex.replace(/\\n(?![a-zA-Z])/g, ' ').replace(/\n/g, ' ');
|
|
|
|
|
|
// 渲染 KaTeX
|
|
|
const rendered = katex.renderToString(cleanLatex, {
|