fix(hololake): ship dynamic persona routes and coherent workspace
This commit is contained in:
parent
5105ec5e32
commit
787ba2ad3f
21 changed files with 1111 additions and 326 deletions
33
product-source/guanghu-knowledge-base/src/markdown.test.ts
Normal file
33
product-source/guanghu-knowledge-base/src/markdown.test.ts
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
import assert from 'node:assert/strict';
|
||||
import test from 'node:test';
|
||||
import { expandWikiLinks, normalizeImportedMarkup, renderKnowledgeMarkdown } from './markdown.js';
|
||||
|
||||
test('expands HoloLake wiki links with labels', () => {
|
||||
assert.equal(
|
||||
expandWikiLinks('进入 [[WAKE-ROUTE|唤醒路径]]'),
|
||||
'进入 [唤醒路径](hololake://knowledge/WAKE-ROUTE "WAKE-ROUTE")',
|
||||
);
|
||||
});
|
||||
|
||||
test('renders tables inside a horizontal scroll container', () => {
|
||||
const html = renderKnowledgeMarkdown('| A | B |\n|---|---|\n| 1 | 2 |');
|
||||
assert.match(html, /class="kb-table-scroll"/);
|
||||
assert.match(html, /<table>/);
|
||||
});
|
||||
|
||||
test('does not execute imported raw HTML or unsafe links', () => {
|
||||
const html = renderKnowledgeMarkdown('<script>alert(1)</script>\n\n[x](javascript:alert(1))');
|
||||
assert.doesNotMatch(html, /<script>/);
|
||||
assert.match(html, /href="#"/);
|
||||
});
|
||||
|
||||
test('renders Outline aside blocks as safe callouts and keeps table line breaks', () => {
|
||||
const source = `<aside>\n👥\n\n责任主体说明。\n</aside>\n\n| 项目 | 说明 |\n| --- | --- |\n| 路径 | 第一行<br>第二行 |`;
|
||||
const normalized = normalizeImportedMarkup(source);
|
||||
assert.match(normalized, /> 👥/);
|
||||
const html = renderKnowledgeMarkdown(source);
|
||||
assert.match(html, /<blockquote>/);
|
||||
assert.match(html, /责任主体说明/);
|
||||
assert.doesNotMatch(html, /<aside>|<aside>/);
|
||||
assert.match(html, /第一行<br>第二行/);
|
||||
});
|
||||
Loading…
Reference in a new issue