Use astro mermaid instead of kroki (not available)

This commit is contained in:
2026-09-07 17:55:53 +02:00
parent cfd3a34609
commit 69ece5aafa
4 changed files with 1121 additions and 162 deletions
+21 -19
View File
@@ -1,12 +1,10 @@
import { defineConfig, fontProviders } from 'astro/config'; import { defineConfig, fontProviders } from "astro/config";
import icon from 'astro-icon'; import icon from "astro-icon";
import mdx from '@astrojs/mdx'; import mdx from "@astrojs/mdx";
//import { remarkModifiedTime } from './src/remark-modified-time.mjs';
import remarkMath from "remark-math"; import remarkMath from "remark-math";
import rehypeMathjax from "rehype-mathjax" import rehypeMathjax from "rehype-mathjax"
import rehypeCallouts from "rehype-callouts"; import rehypeCallouts from "rehype-callouts";
// @ts-ignore import mermaid from "astro-mermaid";
import { remarkKroki } from "remark-kroki";
export default defineConfig({ export default defineConfig({
fonts: [{ fonts: [{
@@ -15,25 +13,29 @@ export default defineConfig({
cssVariable: "--font-cascadia-code", cssVariable: "--font-cascadia-code",
fallbacks: ["monospace"], fallbacks: ["monospace"],
}], }],
integrations: [icon(), mdx()], integrations: [
markdown: { mermaid({
remarkPlugins: [ theme: "dark",
// remarkModifiedTime, autoTheme: false,
remarkMath, [ mermaidConfig: {
remarkKroki, { flowchart: {curve:"linear"},
alias: ["mermaid", "tikz"], startOnLoad: false,
server: process.env.KROKI_SERVER || "https://kroki.io", logLevel: "error",
target: "mdx3", securityLevel: "strict"
output: "inline-svg"
} }
]], }),
icon(),
mdx()
],
markdown: {
remarkPlugins: [remarkMath],
rehypePlugins: [rehypeMathjax, [rehypeCallouts, { theme: "obsidian" }]], rehypePlugins: [rehypeMathjax, [rehypeCallouts, { theme: "obsidian" }]],
shikiConfig: { shikiConfig: {
theme: "one-dark-pro", theme: "one-dark-pro",
}, },
syntaxHighlight: { syntaxHighlight: {
type: 'shiki', type: "shiki",
excludeLangs: ['mermaid', 'math'], excludeLangs: ["mermaid", "math"],
}, },
} }
}); });
+1094 -137
View File
File diff suppressed because it is too large Load Diff
+3 -1
View File
@@ -15,11 +15,13 @@
"@astrojs/mdx": "^5.0.2", "@astrojs/mdx": "^5.0.2",
"@iconify-json/lucide": "^1.2.98", "@iconify-json/lucide": "^1.2.98",
"@iconify-json/simple-icons": "^1.2.74", "@iconify-json/simple-icons": "^1.2.74",
"@mermaid-js/layout-elk": "^0.2.3",
"astro": "^6.0.8", "astro": "^6.0.8",
"astro-icon": "^1.1.5", "astro-icon": "^1.1.5",
"astro-mermaid": "^2.1.0",
"mermaid": "^11.17.2",
"rehype-callouts": "^2.1.2", "rehype-callouts": "^2.1.2",
"rehype-mathjax": "^7.1.0", "rehype-mathjax": "^7.1.0",
"remark-kroki": "^0.3.8",
"remark-math": "^6.0.0" "remark-math": "^6.0.0"
}, },
"devDependencies": { "devDependencies": {
@@ -35,7 +35,6 @@ Am Ende können wir also sagen, dass eine Addition von zwei Bits $a$ und $b$ fol
Wenn wir das nun als Schaubild darstellen, sieht das so aus: Wenn wir das nun als Schaubild darstellen, sieht das so aus:
```mermaid ```mermaid
%%{ init: { 'flowchart': { 'curve': 'linear' }, 'theme': 'dark' } }%%
flowchart TD flowchart TD
A@{ shape: circle, label: "a" } --> XOR1[XOR] A@{ shape: circle, label: "a" } --> XOR1[XOR]
B@{ shape: circle, label: "b" } --> XOR1 B@{ shape: circle, label: "b" } --> XOR1
@@ -72,7 +71,6 @@ Statt nur $a$ und $b$ zu addieren, addieren wir nun $a$, $b$ und den Übertrag $
Unser Schaltplan, sieht dann wieder genauso aus, nur dass wir jetzt noch einen weiteren Eingang für den Übertrag haben: Unser Schaltplan, sieht dann wieder genauso aus, nur dass wir jetzt noch einen weiteren Eingang für den Übertrag haben:
```mermaid ```mermaid
%%{ init: { 'flowchart': { 'curve': 'linear' }, 'theme': 'dark' } }%%
flowchart TD flowchart TD
A@{ shape: circle, label: "a" } --> XOR1 A@{ shape: circle, label: "a" } --> XOR1
B@{ shape: circle, label: "b" } --> XOR1 B@{ shape: circle, label: "b" } --> XOR1
@@ -97,7 +95,6 @@ Das vorher (ohne Übertragseingang) ist ein Halbaddierer.
Wir sehen hier auch, dass unser Volladdierer (FA) aus zwei Halbaddierern (HA) und einem ODER-Gatter besteht: Wir sehen hier auch, dass unser Volladdierer (FA) aus zwei Halbaddierern (HA) und einem ODER-Gatter besteht:
```mermaid ```mermaid
%%{ init: { 'flowchart': { 'curve': 'linear' }, 'theme': 'dark' } }%%
flowchart TD flowchart TD
A0@{ shape: circle, label: "a" } --> HA1 A0@{ shape: circle, label: "a" } --> HA1
B0@{ shape: circle, label: "b" } --> HA1 B0@{ shape: circle, label: "b" } --> HA1
@@ -122,9 +119,9 @@ Und genau so machen wir das auch im Binären.
Wenn wir nun also zwei 4-Bit-Zahlen addieren wollen, brauchen wir 4 Volladdierer, die hintereinander geschaltet und deren Überträge miteinander verbunden sind: Wenn wir nun also zwei 4-Bit-Zahlen addieren wollen, brauchen wir 4 Volladdierer, die hintereinander geschaltet und deren Überträge miteinander verbunden sind:
<div style="overflow-x: auto;width: 100%;"> <div style="overflow-x: auto; width: 100%;">
<div style="min-width: 700px;">
```mermaid ```mermaid
%%{ init: { 'flowchart': { 'curve': 'linear' }, 'theme': 'dark' } }%%
flowchart TD flowchart TD
subgraph FA3 subgraph FA3
A3@{ shape: circle, label: "a_3" } --> FA31 A3@{ shape: circle, label: "a_3" } --> FA31
@@ -152,6 +149,7 @@ flowchart TD
FA01 -- c_0 --> FA11 FA01 -- c_0 --> FA11
end end
``` ```
</div>
</div> </div>
> [!info] Nomenklatur > [!info] Nomenklatur