Skip to content

Commit

Permalink
reuse in
Browse files Browse the repository at this point in the history
  • Loading branch information
stereobooster committed May 5, 2024
1 parent 7ab8ac7 commit ce2ad7d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 9 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ Ideas for other diagrams: https://stereobooster.com/posts/text-to-diagram/.

## TODO

- [ ] reuse `processGraphvizSvg` in `@beoe/astro-graphviz`
- [ ] make `@beoe/cache` usable in Astro components
- [ ] example of gnuplot custom diagram
- any diagram which expects `input.dat`, for example https://gnuplot.sourceforge.net/demo_svg_5.4/histograms.html
Expand Down
11 changes: 3 additions & 8 deletions packages/astro-graphviz/Graphviz.astro
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
---
// Error: require is not defined in ES module scope, you can use import instead
// but this error only happens in build
// import { processGraphvizSvg } from "@beoe/rehype-graphviz";
import { processGraphvizSvg } from "@beoe/rehype-graphviz";
// Error: Command failed with exit code 1. (no details)
// import { serialize } from "node:v8";
// import { getCache } from "@beoe/cache";
Expand All @@ -20,12 +18,9 @@ let svg: string;
// const cacheKey = serialize(Astro.props);
// svg = cache.get(cacheKey);
// if (svg === undefined) {
// svg = processGraphvizSvg(graphviz.dot(Astro.props.code), Astro.props.class);
svg = graphviz.dot(Astro.props.code);
svg = processGraphvizSvg(graphviz.dot(Astro.props.code), Astro.props.class);
// cache.set(cacheKey, svg);
// }
---

<figure class={`beoe graphviz ${Astro.props.class || ""}`}>
<Fragment set:html={svg} />
</figure>
<Fragment set:html={svg} />

0 comments on commit ce2ad7d

Please sign in to comment.