import { describe, expect, it } from "vitest"; import { renderMarkdownToHtml } from "../web/markdown.js"; describe("markdown safe subset render", () => { it("renders GFM tables", () => { const html = renderMarkdownToHtml( ["| 甲 | 乙 |", "| --- | --- |", "| 1 | **粗** |"].join("\n"), ); expect(html).toContain('
| "); expect(html).toContain(" | ");
expect(html).toContain("粗");
expect(html).not.toContain("| 甲 |");
});
it("renders details folds", () => {
const html = renderMarkdownToHtml(
[":::details 规则说明", "里面有 *斜体*", ":::"].join("\n"),
);
expect(html).toContain(' ');
expect(html).toContain(' ');
expect(html).toContain("规则说明");
expect(html).toContain("斜体");
});
it("supports open details", () => {
const html = renderMarkdownToHtml(
[":::details open 已展开", "内容", ":::"].join("\n"),
);
expect(html).toContain(" |
|---|