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. <fangyun1008@gmail.com>
This commit is contained in:
Cursor Agent
2026-09-26 14:06:36 +00:00
committed by brooklyn!
parent f77bf679cb
commit c3b24b74ba

View File

@@ -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)', () => {