import assert from "node:assert/strict"; import test from "node:test"; import { renderMessageMarkdown } from "./message-markdown.ts"; test("final response markdown supports common blocks and escapes raw html", () => { const html = renderMessageMarkdown([ "# Gateway 控制 Windows CMD 的方法", "", "核心工具是 `/app/tools/hwlab-gateway-tran.mjs`。", "", "| 参数 | 作用 |", "|---|---|", "| `cmd` | 透传 Windows cmd |", "", "```bash", "node /app/tools/hwlab-gateway-tran.mjs gws_DESKTOP-1MHOD9I:/f/work cmd -- pwd", "```", "", "raw html should stay inert", "[blocked](javascript:alert(1))", "![blocked-image](https://example.invalid/image.png)" ].join("\n")); assert.match(html, /

Gateway 控制 Windows CMD 的方法<\/h1>/u); assert.match(html, //u); assert.match(html, /
/u);
  assert.match(html, /<span class="message-copy">raw html should stay inert<\/span>/u);
  assert.doesNotMatch(html, //u);
  assert.doesNotMatch(html, /href="javascript:alert\(1\)"/u);
  assert.doesNotMatch(html, /