UNPKG

@nfdi4plants/arc-web-view

Version:

An Annotated Research Context web viewer in the style of GitHub's Primer ProductUI.

24 lines (23 loc) 835 B
import { j as r } from "./lib-D97sP53N.js"; import { useState as s, useEffect as l, useLayoutEffect as c } from "react"; import { marked as f } from "marked"; import m from "mermaid"; import { S as u } from "./index-PcjMzlrv.js"; m.initialize({ startOnLoad: !1 }); function C({ content: e }) { const [t, d] = s(""), [o, i] = s(!0); return l(() => { (async () => { const a = await f.parse(e); d(a), i(!1); })(); }, [e]), c(() => { const n = document.querySelectorAll(".mermaid"); console.log("Mermaid elements found:", n.length), (async () => { console.log("Loading Mermaid..."), await m.run(); })(); }, [t, o]), o ? /* @__PURE__ */ r.jsx(u, { lines: 10 }) : /* @__PURE__ */ r.jsx("div", { className: "markdown-body", dangerouslySetInnerHTML: { __html: t } }); } export { C as default };