Skip to content

Commit fc7f1d5

Browse files
committed
fix: switch Mermaid to client-side rendering for Vercel compatibility
1 parent 30fe0a9 commit fc7f1d5

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

astro.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ export default defineConfig({
7171
remarkPlugins: [remarkMath, remarkGfm],
7272
rehypePlugins: [
7373
rehypeSlug,
74-
[rehypeMermaid, { strategy: "img-png" }],
74+
[rehypeMermaid, { strategy: "pre-mermaid" }],
7575
[
7676
rehypeAutolinkHeadings,
7777
{

src/components/HeadCommon.astro

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,12 @@ import "../styles/design-system/global-styles.css"
2020
<!-- Scrollable a11y code helper -->
2121
<script src="/make-scrollable-code-focusable.js" is:inline></script>
2222

23+
<!-- Mermaid.js for client-side rendering -->
24+
<script type="module">
25+
import mermaid from "https://cdn.jsdelivr.net/npm/mermaid@10/dist/mermaid.esm.min.mjs"
26+
mermaid.initialize({ startOnLoad: true, theme: "default" })
27+
</script>
28+
2329
<!-- Google Tag Manager -->
2430
<!-- <script type="text/javascript">
2531
;(function (w, d, s, l, i) {

src/styles/index.css

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -419,3 +419,7 @@ h2.heading {
419419
.mermaid-diagram > img {
420420
height: auto;
421421
}
422+
423+
.mermaid {
424+
background: transparent;
425+
}

0 commit comments

Comments
 (0)