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.
46 lines
1.9 KiB
TypeScript
46 lines
1.9 KiB
TypeScript
import { getMarkdown, parseMarkdownToStructure } from 'stream-markdown-parser'
|
|
import { describe, expect, it } from 'vitest'
|
|
|
|
describe('custom html close followed by block markers (same line)', () => {
|
|
const tags = ['think']
|
|
const md = getMarkdown('custom-html-close-followed-by-block-markers', { customHtmlTags: tags })
|
|
const prefix = '<think>t</think>'
|
|
|
|
type Case
|
|
= | { label: string, suffix: string, expectedType: string }
|
|
| { label: string, markdown: string, expectedType: string }
|
|
|
|
const cases: Case[] = [
|
|
{ label: 'heading', suffix: '## h', expectedType: 'heading' },
|
|
{ label: 'bullet list', suffix: '- a', expectedType: 'list' },
|
|
{ label: 'ordered list', suffix: '1. a', expectedType: 'list' },
|
|
{ label: 'blockquote', suffix: '> q', expectedType: 'blockquote' },
|
|
{ label: 'fence', suffix: '```js\nx\n```', expectedType: 'code_block' },
|
|
{ label: 'table', suffix: '| a | b |\n| - | - |\n| 1 | 2 |', expectedType: 'table' },
|
|
{ label: 'thematic break', suffix: '---', expectedType: 'thematic_break' },
|
|
{ label: 'admonition', suffix: '::: tip\nx\n:::', expectedType: 'admonition' },
|
|
{ label: 'math block', suffix: '$$\n1+1\n$$', expectedType: 'math_block' },
|
|
]
|
|
|
|
// Footnote definitions only become a structured "footnote" node when there is
|
|
// a corresponding reference in the document.
|
|
cases.push({
|
|
label: 'footnote',
|
|
markdown: `A[^1].\n\n${prefix}[^1]: x`,
|
|
expectedType: 'footnote',
|
|
})
|
|
|
|
const normalizedCases = cases.map((c) => {
|
|
if ('markdown' in c)
|
|
return c
|
|
return { label: c.label, markdown: `${prefix}${c.suffix}`, expectedType: c.expectedType }
|
|
})
|
|
|
|
for (const c of normalizedCases) {
|
|
it(`splits boundary for ${c.label}`, () => {
|
|
const nodes = parseMarkdownToStructure(c.markdown, md, { customHtmlTags: tags, final: true }) as any[]
|
|
expect(nodes.some(n => n?.type === c.expectedType)).toBe(true)
|
|
})
|
|
}
|
|
})
|