import assert from "node:assert/strict"; import test from "node:test"; import { markdownImages, renderMarkdownHtml, renderMarkdownSections } from "../src/lib/workspace/noteHtml.ts"; const render = (text: string) => renderMarkdownHtml(text, new Map()); test("writing sections retain exact source ranges and document-wide references", () => { const source = '\uFEFF---\r\ntitle: Draft\r\n---\r\n\r\n# Heading\r\n\r\n- Parent\r\n - Child\r\n\r\nA [reference][ref].\r\n\r\n[ref]: https://example.com\r\n'; const sections = renderMarkdownSections(source, new Map()); assert.equal(sections.map(section => source.slice(section.start, section.end)).join(""), source); assert.equal(sections.length, 4); assert.match(sections[2].html, /