Server API
The server entry draws Mermaid for hosts that cannot: as a self-contained SVG for a page, or as Unicode box drawing for a text surface.
import { mermaidSvg, mermaidText } from "pi-better-show/server";
mermaidSvg(source: string, options?: { scheme?: "light" | "dark" | DiagramColors; font?: string; transparent?: boolean }): stringmermaidText(source: string, width = 60): string | undefinedmermaidSvg draws a self-contained SVG in the colours of scheme (use real colours; an image URL cannot read the host page’s CSS). It has no @import and no <script>, and throws on a source it cannot draw. mermaidText draws Unicode box drawing, and returns undefined when the source is invalid, a line is wider than width, or a wide (CJK, emoji) character would misalign the boxes. It is the mermaid hook for toText:
toText(parse(reply), { flavor: "discord", mermaid: mermaidText });