import assert from "node:assert/strict"; import test from "node:test"; import { htmlToMarkdown } from "../src/lib/workspace/htmlToMarkdown.ts"; test("headings and inline marks become markdown", () => { const html = "

Heading 1

Heading 2

hello bold and code

"; assert.equal(htmlToMarkdown(html), "# Heading 1\n## Heading 2\nhello **bold** and `code`"); }); test("fences keep language and body", () => { const html = '
const x = 1
'; assert.equal(htmlToMarkdown(html), "```js\nconst x = 1\n```"); }); test("wiki and markdown links become markdown", () => { const html = '

see projects/alpha and label

'; assert.equal(htmlToMarkdown(html), "see [[projects/alpha]] and [label](notes/a.md)"); }); test("wiki image uses data-md-kind", () => { const html = '

screenshot.png

'; assert.equal(htmlToMarkdown(html), "![[screenshot.png]]"); }); test("strike super and sub become markdown", () => { const html = "

old x2 an

"; assert.equal(htmlToMarkdown(html), "~~old~~ x^2^ a~n~"); }); test("gfm table becomes markdown", () => { const html = "
AB
12
"; assert.equal(htmlToMarkdown(html), "| A | B |\n| --- | --- |\n| 1 | 2 |"); }); test("checked task item becomes a checkbox line", () => { const html = ''; assert.equal(htmlToMarkdown(html), "- [x] done"); }); test("unchecked task item becomes an empty checkbox", () => { const html = ''; assert.equal(htmlToMarkdown(html), "- [ ] todo"); }); test("italic highlight math and comment become markdown", () => { const html = '

hi glow x^2 note

'; assert.equal(htmlToMarkdown(html), "*hi* ==glow== $x^2$ %%note%%"); }); test("blockquote and numbered list become markdown", () => { const html = "

said

  1. one
  2. two
"; assert.equal(htmlToMarkdown(html), "> said\n1. one\n2. two"); });