import { readFile } from "node:fs/promises";
import { MarkdownDocument as ReactDocument } from "@comark/react";
import { MarkdownDocument as VueDocument } from "@comark/vue";
import { parseMarkdown } from "comark";
import { createElement } from "react";
import { renderToString as renderReact } from "react-dom/server";
import { compile } from "svelte/compiler";
import { describe, expect, it } from "vite-plus/test";
import { createSSRApp, h } from "vue";
import { renderToString as renderVue } from "vue/server-renderer";
import zoom from "../src/index.ts";
import { components as reactComponents } from "../src/react.ts";
import { components as vueComponents } from "../src/vue.ts";
const markdown =
'\n\n::zoom{group="tour" title="Step"}\n> Any **content**\n::\n\n::zoom{#step .wide foo="bar"}\nx\n::';
const parse = () => parseMarkdown(markdown, { plugins: [zoom()] });
describe("comark-zoom renderers", () => {
it("renders the same zoomable markup in Vue", async () => {
const value = await parse();
const html = await renderVue(
createSSRApp({ render: () => h(VueDocument, { value, components: vueComponents }) }),
);
expect(html).toMatch(/
/,
);
expect(html).toContain("content");
expect(html).toMatch(/
/,
);
expect(html).toContain("content");
expect(html).toMatch(/