import { execFile } from "node:child_process"; import { mkdtemp, readFile, writeFile } from "node:fs/promises"; import { tmpdir } from "node:os"; import { join } from "node:path"; import { promisify } from "node:util"; import { renderHtmlFromDocument } from "@comark/html"; import { parseMarkdown } from "comark"; import { scripts as carouselScripts } from "comark-carousel/html"; import security from "comark/plugins/security"; import { afterEach, describe, expect, it, vi } from "vite-plus/test"; import annotate, { components, scripts } from "../src/html.ts"; import xref from "../../xref/src/index.ts"; async function run(markdown: string, options?: Parameters[0]) { const document = await parseMarkdown(markdown, { plugins: [annotate(options)] }); return { issues: document.meta.issues, html: await renderHtmlFromDocument(document, { components }), document, }; } // The stylesheet the renderer inlines, so the tests read the CSS a reader's browser gets. const styles = (html: string) => /