e0a5f57793
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.
54 lines
2.0 KiB
TypeScript
54 lines
2.0 KiB
TypeScript
import { getMarkdown, parseMarkdownToStructure } from 'stream-markdown-parser'
|
|
import { describe, expect, it } from 'vitest'
|
|
|
|
describe('math block with spaces between characters', () => {
|
|
it('should parse $$ with spaced subscript as math_block', () => {
|
|
const md = getMarkdown('test')
|
|
|
|
const markdown = `$$
|
|
f _ { t r a n s f e r } : M _ { s } M _ { l }
|
|
$$`
|
|
|
|
const tokens = md.parse(markdown, {})
|
|
console.log('=== Tokens ===')
|
|
tokens.forEach((token, i) => {
|
|
console.log(` ${i}: type=${token.type} tag=${token.tag} content="${String(token.content || '').slice(0, 60)}" markup=${token.markup}`)
|
|
})
|
|
|
|
const mathBlocks = tokens.filter(token => token.type === 'math_block')
|
|
console.log(`\nMath blocks found: ${mathBlocks.length}`)
|
|
mathBlocks.forEach((block, i) => {
|
|
console.log(` Block ${i + 1}: content="${block.content}" markup="${block.markup}"`)
|
|
})
|
|
|
|
// 应该识别为 math_block
|
|
expect(mathBlocks.length).toBeGreaterThanOrEqual(1)
|
|
expect(mathBlocks[0].content).toContain('f _ { t r a n s f e r }')
|
|
})
|
|
|
|
it('should parse the spaced subscript math with parseMarkdownToStructure', () => {
|
|
const md = getMarkdown('test')
|
|
|
|
const markdown = `$$
|
|
f _ { t r a n s f e r } : M _ { s } M _ { l }
|
|
$$`
|
|
|
|
const nodes = parseMarkdownToStructure(markdown, md)
|
|
console.log('=== Nodes ===')
|
|
nodes.forEach((node, i) => {
|
|
console.log(` ${i}: type=${node.type} content="${String((node as any).content || '').slice(0, 60)}"`)
|
|
})
|
|
|
|
// 检查是否有 math_block 节点
|
|
const mathBlocks = nodes.filter(node => node.type === 'math_block')
|
|
console.log(`\nMath block nodes found: ${mathBlocks.length}`)
|
|
mathBlocks.forEach((block, i) => {
|
|
console.log(` Block ${i + 1}: content="${String((block as any).content)}"`)
|
|
})
|
|
|
|
// 应该识别为 math_block 节点
|
|
expect(mathBlocks.length).toBeGreaterThanOrEqual(1)
|
|
expect(String((mathBlocks[0] as any).content)).toContain('f _ { t r a n s f e r }')
|
|
})
|
|
})
|