Astro component to generate Graphviz diagrams as inline SVG.
In MDX or Astro:
import { Graphviz } from "@beoe/astro-graphviz";
<Graphviz
code={`digraph finite_state_machine {
bgcolor="transparent";
start -> end
}`}
/>
It also provides rehype plugin (re-exports @beoe/rehype-graphviz) with cache preconfigured:
import { rehypeGraphviz } from "@beoe/astro-graphviz/rehype";
// https://astro.build/config
export default defineConfig({
markdown: {
rehypePlugins: [rehypeGraphviz],
},
});
- use
@beoe/cache
in Astro component - add type declarations for
@beoe/astro-graphviz/rehype