Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
stereobooster committed Jan 23, 2025
1 parent fed407a commit 0f294b2
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 14 deletions.
2 changes: 1 addition & 1 deletion experiments/rehype-plantuml/test/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ it.skip("renders diagram", async () => {
const file = await unified()
.use(remarkParse)
.use(remarkRehype)
.use(rehypePlantuml, { strategy: "img" })
.use(rehypePlantuml, { strategy: "data-url" })
.use(rehypeStringify)
.process(await fs.readFile(new URL("./fixtures/a.md", import.meta.url)));

Expand Down
25 changes: 16 additions & 9 deletions packages/docs/astro.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import { rehypeGraphviz } from "@beoe/rehype-graphviz";
import { rehypeGnuplot } from "@beoe/rehype-gnuplot";
import { rehypeVizdom } from "@beoe/rehype-vizdom";
import { rehypeD2 } from "@beoe/rehype-d2";
import { rehypePenrose } from "@beoe/rehype-penrose";

const cache = await getCache();
// requerd for correct displaying mobile warning
Expand All @@ -21,6 +20,21 @@ const conf = {
fsPath: "public/beoe",
webPath: "/beoe",
};
const rehypePlugins = [
[rehypeGraphviz, { cache, class: className }],
[rehypeVizdom, { cache, class: className }],
[rehypeMermaid, conf],
[rehypeGnuplot, conf],
[rehypeD2, { ...conf, shared: "shared/**/*.d2" }],
];
if (import.meta.env.DEV) {
// this breaks build
const { rehypePenrose } = await import("@beoe/rehype-penrose");
rehypePlugins.push([
rehypePenrose,
{ ...conf, shared: "shared", svgo: false },
]);
}

// https://astro.build/config
export default defineConfig({
Expand Down Expand Up @@ -59,14 +73,7 @@ export default defineConfig({
}),
],
markdown: {
rehypePlugins: [
[rehypeGraphviz, { cache, class: className }],
[rehypeVizdom, { cache, class: className }],
[rehypeMermaid, conf],
[rehypeGnuplot, conf],
[rehypeD2, { ...conf, shared: "shared/**/*.d2" }],
[rehypePenrose, { ...conf, shared: "shared", svgo: false }],
],
rehypePlugins,
},
vite: {
plugins: [qrcode()],
Expand Down
4 changes: 2 additions & 2 deletions packages/docs/src/content/docs/examples/vizdom-test.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ digraph TD {
}
```

### `strategy=img`
### `strategy=data-url`

```vizdom strategy=img
```vizdom strategy=data-url
digraph TD {
node [shape=box]
rankdir="LR"
Expand Down
2 changes: 1 addition & 1 deletion packages/rehype-code-hook-img/test/fixtures/c.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
```test strategy=img
```test strategy=data-url
test
```
2 changes: 1 addition & 1 deletion packages/rehype-d2/test/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ it("renders diagram", async () => {
const file = await unified()
.use(remarkParse)
.use(remarkRehype)
.use(rehypeD2, { strategy: "img" })
.use(rehypeD2, { strategy: "data-url" })
.use(rehypeStringify)
.process(await fs.readFile(new URL("./fixtures/a.md", import.meta.url)));

Expand Down

0 comments on commit 0f294b2

Please sign in to comment.