Files
BoosAPI/desktop/libs/markstream-vue/test/parseMarkdownToStructure-angle-bracket-math-regression.test.ts
boos e0a5f57793 feat(desktop): embed BoosAPI Desktop client as a subproject
Vendor the rebranded BoosAPI Desktop client (Tauri + Vue) into metapi as
a monorepo subdirectory under desktop/. Source only — node_modules,
dist, Cargo target and the upstream .git history are excluded.

desktop/ keeps its own independent Cargo workspace (desktop/src-tauri
with crates/*); it is not part of the backend boosapi crate, so a
`cargo check` at the metapi root still compiles only the backend. Build
the desktop app from desktop/src-tauri per desktop/README.md.

Note: app icons are still placeholder assets pending the final BoosAPI
logo. The updater signing keys live outside the repo and are not
included.
2026-06-22 11:32:57 +08:00

46 lines
1.5 KiB
TypeScript

import { getMarkdown, parseMarkdownToStructure } from 'stream-markdown-parser'
import { describe, expect, it } from 'vitest'
describe('parseMarkdownToStructure regressions (angle bracket in math)', () => {
function collectText(nodes: any, out: string[] = []) {
if (!nodes)
return out
if (Array.isArray(nodes)) {
for (const n of nodes)
collectText(n, out)
return out
}
if (typeof nodes !== 'object')
return out
const node = nodes as any
if (typeof node.content === 'string')
out.push(node.content)
if (typeof node.raw === 'string')
out.push(node.raw)
if (node.children)
collectText(node.children, out)
if (node.rows)
collectText(node.rows, out)
if (node.cells)
collectText(node.cells, out)
return out
}
it('does not drop trailing content when inline math contains `<`', () => {
const md = getMarkdown('angle-bracket-math')
const markdown = `> **给定输入 $ x $ 和上下文 $ \\\\gamma $,模型要根据已生成的部分输出 $ y_{<i} $,逐 token 地预测下一个 token $ y_i $,并最大化所有 token 的联合概率。**
这个 markdown 后面这一段不应丢失。`
expect(() => parseMarkdownToStructure(markdown, md)).not.toThrow()
const nodes = parseMarkdownToStructure(markdown, md)
const text = collectText(nodes).join('')
expect(text).toContain('联合概率')
expect(text).toContain('这个 markdown 后面这一段不应丢失')
})
})