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.
25 lines
1.2 KiB
TypeScript
25 lines
1.2 KiB
TypeScript
import { getMarkdown, parseMarkdownToStructure } from 'stream-markdown-parser'
|
|
import { describe, expect, it } from 'vitest'
|
|
|
|
describe('custom html close followed by heading marker (same line)', () => {
|
|
const md = getMarkdown('custom-html-close-heading-same-line', { customHtmlTags: ['think'] })
|
|
|
|
it('parses the trailing "##" as a heading node (not plain text)', () => {
|
|
const markdown = `<think>让我思考一下</think>## 我是潮位站潮位预报智能体,\n专门负责为您提供镇海潮位站的潮位预报服务。`
|
|
const nodes = parseMarkdownToStructure(markdown, md, { customHtmlTags: ['think'], final: true }) as any[]
|
|
|
|
// The custom tag can be represented as a root node (html_block) or as an inline
|
|
// custom node wrapped in a paragraph depending on markdown-it tokenization.
|
|
const hasThinkRoot = nodes[0]?.type === 'think'
|
|
const hasThinkInline = nodes[0]?.type === 'paragraph'
|
|
&& Array.isArray(nodes[0]?.children)
|
|
&& nodes[0].children.some((c: any) => c?.type === 'think' && c?.loading === false)
|
|
|
|
expect(hasThinkRoot || hasThinkInline).toBe(true)
|
|
|
|
expect(nodes[1].type).toBe('heading')
|
|
expect(nodes[1].level).toBe(2)
|
|
expect(nodes[1].text).toContain('我是潮位站潮位预报智能体')
|
|
})
|
|
})
|