import { createSignal, Show } from "solid-js" import { render } from "solid-js/web" import { DialogProvider } from "@opencode/ui/context/dialog" import { I18nProvider, useI18n } from "@opencode/ui/context/i18n" import { Markdown } from "../src/components/markdown" import { preloadMarkdown } from "../src/components/markdown-cache" import { MarkdownProvider, type MarkdownLocalFileExists } from "../src/context/markdown" import { OpenCode } from "@opencode/client/promise" import { readLocalImage } from "../../app/src/runtime/server/image" export { getCachedMarkdown, renderCachedMarkdown, sanitizeMarkdown, touchCachedMarkdown, } from "../src/components/markdown-cache" export { renderMermaidSvg } from "../src/components/markdown-mermaid" export { MarkdownWorkerDisposedError } from "../src/components/markdown-worker" export { preloadMarkdown } // Inline code naming one of these is a file link; any other path stays plain code. const existingFiles = new Set(["src/file.ts", "new/file.ts"]) export async function mountMarkdown(options: { text: string streaming?: boolean cached?: boolean images?: boolean synchronousFiles?: boolean localFileExists?: MarkdownLocalFileExists }) { if (options.cached) await preloadMarkdown(options.text, "markdown-test") const host = document.createElement("div") host.dataset.testid = "markdown-fixture" document.body.appendChild(host) render(() => { const api = OpenCode.make({ baseUrl: location.origin, headers: { Authorization: `Basic ${btoa("opencode:fixture")}` }, }) const [text, setText] = createSignal(options.text) const [streaming, setStreaming] = createSignal(options.streaming ?? false) const [visible, setVisible] = createSignal(true) const [german, setGerman] = createSignal(false) const english = useI18n() return (