From c3b24b74ba5dc3bb8e1312e21fa4d66740aa3afc Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Sat, 26 Sep 2026 14:06:36 +0000 Subject: [PATCH] test(desktop): pin backslash math and the CJK-variable tradeoff A span whose body is a backslash command is real math, and a CJK variable inside one equation must still escape while the next span stays. Co-authored-by: Yun. --- .../src/components/assistant-ui/markdown-text.test.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/apps/desktop/src/components/assistant-ui/markdown-text.test.ts b/apps/desktop/src/components/assistant-ui/markdown-text.test.ts index 2d67bf17c4..ed6834017e 100644 --- a/apps/desktop/src/components/assistant-ui/markdown-text.test.ts +++ b/apps/desktop/src/components/assistant-ui/markdown-text.test.ts @@ -578,6 +578,12 @@ describe('preprocessMarkdown', () => { expect(preprocessMarkdown('$E = mc^2$ 代入 $x$ 求解')).toBe('$E = mc^2$ 代入 $x$ 求解') expect(preprocessMarkdown('$a$ 与 $b$ 之间的说明')).toBe('$a$ 与 $b$ 之间的说明') expect(preprocessMarkdown('$a$ 甲 $b$ 乙 $c$ 丙')).toBe('$a$ 甲 $b$ 乙 $c$ 丙') + // Backslash commands are real math too; the closer must not be re-opened. + expect(preprocessMarkdown('根据 $\\alpha$ 和 $\\beta$ 计算')).toBe('根据 $\\alpha$ 和 $\\beta$ 计算') + }) + + it('still escapes a CJK variable inside one equation and keeps the next span (#103546)', () => { + expect(preprocessMarkdown('$x = 变量$ 与 $y$')).toBe('\\$x = 变量\\$ 与 $y$') }) it('leaves real inline math adjacent to CJK untouched (#103546)', () => {