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.
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
import { getMarkdown, parseMarkdownToStructure } from 'stream-markdown-parser'
|
||||
import { describe, expect, it } from 'vitest'
|
||||
|
||||
describe('containers plugin', () => {
|
||||
it('renders admonition container via ::: admonition', () => {
|
||||
const md = getMarkdown('t')
|
||||
const content = `::: note\nThis is a note\n:::`
|
||||
const html = md.render(content)
|
||||
expect(html).toContain('vmr-container-note')
|
||||
expect(html).toContain('This is a note')
|
||||
})
|
||||
|
||||
it('renders multiple container types', () => {
|
||||
const md = getMarkdown('t')
|
||||
const content = `::: warning\nWarn\n:::\n\n::: tip\nTip\n:::`
|
||||
const html = md.render(content)
|
||||
expect(html).toContain('vmr-container-warning')
|
||||
expect(html).toContain('vmr-container-tip')
|
||||
})
|
||||
|
||||
it('renders warning block with expected HTML structure', () => {
|
||||
const md = getMarkdown('play')
|
||||
const content = `::: warning\n这是一个警告块。\n:::`
|
||||
const html = md.render(content)
|
||||
// exact wrapper class
|
||||
expect(html).toContain('class="vmr-container vmr-container-warning"')
|
||||
// contains paragraph with content
|
||||
expect(html).toContain('<p>这是一个警告块。</p>')
|
||||
})
|
||||
|
||||
it('preserves original markdown inside container', () => {
|
||||
const md = getMarkdown('t')
|
||||
const content = `::: note-test \n# head text\n:::`
|
||||
const tokens = parseMarkdownToStructure(content, md)
|
||||
|
||||
// the raw should contain the markdown `# head text`
|
||||
expect(tokens).toEqual(
|
||||
expect.arrayContaining([
|
||||
expect.objectContaining({
|
||||
raw: expect.stringContaining('#'),
|
||||
}),
|
||||
]),
|
||||
)
|
||||
})
|
||||
})
|
||||
@@ -0,0 +1,30 @@
|
||||
import { getMarkdown } from 'stream-markdown-parser'
|
||||
import { describe, expect, it } from 'vitest'
|
||||
|
||||
function extractFenceTokens(md: ReturnType<typeof getMarkdown>, src: string) {
|
||||
const tokens = md.parse(src, {}) as any[]
|
||||
return tokens.filter((t: any) => t.type === 'fence')
|
||||
}
|
||||
|
||||
describe('fence streaming plugin', () => {
|
||||
it('sets closed=true for closed ``` fences', () => {
|
||||
const md = getMarkdown('t')
|
||||
const src = '```ts\nconst a=1\n```\n'
|
||||
const [f] = extractFenceTokens(md, src)
|
||||
expect(f?.meta?.closed).toBe(true)
|
||||
})
|
||||
|
||||
it('sets closed=false for unclosed ``` fences', () => {
|
||||
const md = getMarkdown('t')
|
||||
const src = '```ts\nconst a=1\n' // no closing fence
|
||||
const [f] = extractFenceTokens(md, src)
|
||||
expect(f?.meta?.closed).toBe(false)
|
||||
})
|
||||
|
||||
it('supports ~~~ fences and closed detection', () => {
|
||||
const md = getMarkdown('t')
|
||||
const src = '~~~js\nlet x=1\n~~~\n'
|
||||
const [f] = extractFenceTokens(md, src)
|
||||
expect(f?.meta?.closed).toBe(true)
|
||||
})
|
||||
})
|
||||
@@ -0,0 +1,70 @@
|
||||
import { getMarkdown } from 'stream-markdown-parser'
|
||||
import { describe, expect, it } from 'vitest'
|
||||
|
||||
describe('math plugin (inline & block)', () => {
|
||||
it('parses inline $...$ and ( ... ) maths', () => {
|
||||
const md = getMarkdown('t')
|
||||
const content = '这是行内数学 $a+b=3$ 和另外一种 \\(--x\\)'
|
||||
const html = md.render(content)
|
||||
|
||||
// Should render math inline - either our inline wrapper or MathJax output or raw content
|
||||
const ok
|
||||
= html.includes('vmr-math-inline')
|
||||
|| html.includes('math')
|
||||
|| html.includes('a+b=3')
|
||||
|
||||
expect(ok).toBe(true)
|
||||
})
|
||||
|
||||
it('parses block $$...$$ maths', () => {
|
||||
const md = getMarkdown('t')
|
||||
const content = `前文\n$$\nE=mc^2\n$$\n后文`
|
||||
const tokens = md.parse(content, {})
|
||||
const blocks = tokens.filter((t: any) => t.type === 'math_block')
|
||||
expect(blocks.length).toBe(1)
|
||||
expect(blocks[0].content).toContain('E=mc^2')
|
||||
})
|
||||
|
||||
it('does not treat escaped dollar as math', () => {
|
||||
const md = getMarkdown('t')
|
||||
const content = 'price is $5 and not math $not$'
|
||||
const tokens = md.parse(content, {})
|
||||
const inline = tokens
|
||||
.flatMap((t: any) => (t.children ? t.children : []))
|
||||
.filter(
|
||||
(c: any) =>
|
||||
c && (c.type === 'vmr_math_inline' || c.type === 'math_inline'),
|
||||
)
|
||||
// Expect none (we may get tokens as text)
|
||||
expect(inline.length).toBeLessThanOrEqual(1)
|
||||
})
|
||||
|
||||
it('parses inline math in content', () => {
|
||||
const md = getMarkdown('t')
|
||||
const content = '- **二项式展开**(\(\(m\) 为实数):'
|
||||
const tokens = md.parse(content, {})
|
||||
const inline = tokens.filter(token => token.type === 'inline')[0]
|
||||
console.log({ children: inline.children })
|
||||
expect(inline.content).toBe('**二项式展开**(((m) 为实数):')
|
||||
expect(inline.children?.slice(-1)[0].content).toMatchInlineSnapshot(`"(((m) 为实数):"`)
|
||||
})
|
||||
|
||||
it('parses list_item', () => {
|
||||
const md = getMarkdown('t')
|
||||
const content = '- \\*'
|
||||
const tokens = md.parse(content, {})
|
||||
console.log({ tokens })
|
||||
const types = tokens.map(t => t.type)
|
||||
expect(types).toMatchInlineSnapshot(`
|
||||
[
|
||||
"bullet_list_open",
|
||||
"list_item_open",
|
||||
"paragraph_open",
|
||||
"inline",
|
||||
"paragraph_close",
|
||||
"list_item_close",
|
||||
"bullet_list_close",
|
||||
]
|
||||
`)
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user