Skip to content

Commit 5723431

Browse files
committed
feat: add mermaid diagram support for all content pages
1 parent b3be48b commit 5723431

10 files changed

Lines changed: 42 additions & 2 deletions

File tree

src/pages/ai/models/[slug].astro

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ const { Content } = await post.render();
2424
<link rel="icon" href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><text y='.9em' font-size='90'>⚡</text></svg>" />
2525
<title>{post.data.title} | Awesome AI</title>
2626
<meta name="description" content={post.data.summary || post.data.title} />
27+
<script type="module">
28+
import mermaid from 'https://cdn.jsdelivr.net/npm/mermaid@10/dist/mermaid.esm.min.mjs';
29+
mermaid.initialize({ startOnLoad: true, theme: 'dark' });
30+
</script>
2731
</head>
2832
<body class="bg-bg text-text font-sans antialiased flex flex-col min-h-screen">
2933
<NavBar locale="zh" currentPath="/ai" />

src/pages/ai/tools/[slug].astro

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,13 @@ const { Content } = await post.render();
2424
<link rel="icon" href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><text y='.9em' font-size='90'>⚡</text></svg>" />
2525
<title>{post.data.title} | Awesome AI</title>
2626
<meta name="description" content={post.data.summary || post.data.title} />
27+
<script type="module">
28+
import mermaid from 'https://cdn.jsdelivr.net/npm/mermaid@10/dist/mermaid.esm.min.mjs';
29+
mermaid.initialize({ startOnLoad: true, theme: 'dark' });
30+
</script>
2731
</head>
2832
<body class="bg-bg text-text font-sans antialiased flex flex-col min-h-screen">
29-
<NavBar locale="zh" currentPath="/ai" />
33+
<NavBar locale="zh" currentPath="/ai/tools" />
3034

3135
<main class="max-w-[780px] mx-auto px-4 sm:px-6 pt-[72px] sm:pt-[80px] pb-[40px] sm:pb-[60px] flex-1 w-full animate-fade-in">
3236
<a href="/ai" class="inline-flex items-center gap-1.5 text-text-dim text-xs sm:text-sm mb-4 sm:mb-6 px-3 sm:px-4 py-2 rounded-lg border border-border bg-bg-card hover:text-text hover:bg-accent-glow hover:border-accent transition-all no-underline">

src/pages/daily/[slug].astro

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ const formattedDate = `${dateParts[0]} 年 ${parseInt(dateParts[1])} 月 ${parse
2727
<link rel="icon" href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><text y='.9em' font-size='90'>⚡</text></svg>" />
2828
<title>{post.data.title} | Awesome AI</title>
2929
<meta name="description" content={post.data.summary || post.data.title} />
30+
<script type="module">
31+
import mermaid from 'https://cdn.jsdelivr.net/npm/mermaid@10/dist/mermaid.esm.min.mjs';
32+
mermaid.initialize({ startOnLoad: true, theme: 'dark' });
33+
</script>
3034
</head>
3135
<body class="bg-bg text-text font-sans antialiased flex flex-col min-h-screen">
3236
<NavBar locale="zh" currentPath="/daily" />

src/pages/en/ai/models/[slug].astro

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ const { Content } = await post.render();
2525
<link rel="icon" href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><text y='.9em' font-size='90'>⚡</text></svg>" />
2626
<title>{post.data.title} | Awesome AI</title>
2727
<meta name="description" content={post.data.summary || post.data.title} />
28+
<script type="module">
29+
import mermaid from 'https://cdn.jsdelivr.net/npm/mermaid@10/dist/mermaid.esm.min.mjs';
30+
mermaid.initialize({ startOnLoad: true, theme: 'dark' });
31+
</script>
2832
</head>
2933
<body class="bg-bg text-text font-sans antialiased flex flex-col min-h-screen">
3034
<NavBar locale="en" currentPath="/en/ai" />

src/pages/en/ai/tools/[slug].astro

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,13 @@ const { Content } = await post.render();
2525
<link rel="icon" href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><text y='.9em' font-size='90'>⚡</text></svg>" />
2626
<title>{post.data.title} | Awesome AI</title>
2727
<meta name="description" content={post.data.summary || post.data.title} />
28+
<script type="module">
29+
import mermaid from 'https://cdn.jsdelivr.net/npm/mermaid@10/dist/mermaid.esm.min.mjs';
30+
mermaid.initialize({ startOnLoad: true, theme: 'dark' });
31+
</script>
2832
</head>
2933
<body class="bg-bg text-text font-sans antialiased flex flex-col min-h-screen">
30-
<NavBar locale="en" currentPath="/en/ai" />
34+
<NavBar locale="en" currentPath="/en/ai/tools" />
3135

3236
<main class="max-w-[780px] mx-auto px-4 sm:px-6 pt-[72px] sm:pt-[80px] pb-[40px] sm:pb-[60px] flex-1 w-full animate-fade-in">
3337
<a href="/en/ai" class="inline-flex items-center gap-1.5 text-text-dim text-xs sm:text-sm mb-4 sm:mb-6 px-3 sm:px-4 py-2 rounded-lg border border-border bg-bg-card hover:text-text hover:bg-accent-glow hover:border-accent transition-all no-underline">

src/pages/en/daily/[slug].astro

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ const { Content } = await post.render();
2424
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
2525
<link rel="icon" href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><text y='.9em' font-size='90'>⚡</text></svg>" />
2626
<title>{post.data.title} | Awesome AI</title>
27+
<script type="module">
28+
import mermaid from 'https://cdn.jsdelivr.net/npm/mermaid@10/dist/mermaid.esm.min.mjs';
29+
mermaid.initialize({ startOnLoad: true, theme: 'dark' });
30+
</script>
2731
</head>
2832
<body class="bg-bg text-text font-sans antialiased flex flex-col min-h-screen">
2933
<NavBar locale="en" currentPath="/en/daily" />

src/pages/en/topics/[slug].astro

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ const { Content } = await post.render();
2525
<link rel="icon" href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><text y='.9em' font-size='90'>⚡</text></svg>" />
2626
<title>{post.data.title} | Awesome AI</title>
2727
<meta name="description" content={post.data.summary || post.data.title} />
28+
<script type="module">
29+
import mermaid from 'https://cdn.jsdelivr.net/npm/mermaid@10/dist/mermaid.esm.min.mjs';
30+
mermaid.initialize({ startOnLoad: true, theme: 'dark' });
31+
</script>
2832
</head>
2933
<body class="bg-bg text-text font-sans antialiased flex flex-col min-h-screen">
3034
<NavBar locale="en" currentPath="/en/topics" />

src/pages/en/weekly/[slug].astro

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ function formatWeekDate(weekStr: string): string {
2828
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
2929
<link rel="icon" href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><text y='.9em' font-size='90'>⚡</text></svg>" />
3030
<title>{post.data.title} | Awesome AI</title>
31+
<script type="module">
32+
import mermaid from 'https://cdn.jsdelivr.net/npm/mermaid@10/dist/mermaid.esm.min.mjs';
33+
mermaid.initialize({ startOnLoad: true, theme: 'dark' });
34+
</script>
3135
</head>
3236
<body class="bg-bg text-text font-sans antialiased flex flex-col min-h-screen">
3337
<NavBar locale="en" currentPath="/en/weekly" />

src/pages/topics/[slug].astro

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ const { Content } = await post.render();
2424
<link rel="icon" href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><text y='.9em' font-size='90'>⚡</text></svg>" />
2525
<title>{post.data.title} | Awesome AI</title>
2626
<meta name="description" content={post.data.summary || post.data.title} />
27+
<script type="module">
28+
import mermaid from 'https://cdn.jsdelivr.net/npm/mermaid@10/dist/mermaid.esm.min.mjs';
29+
mermaid.initialize({ startOnLoad: true, theme: 'dark' });
30+
</script>
2731
</head>
2832
<body class="bg-bg text-text font-sans antialiased flex flex-col min-h-screen">
2933
<NavBar locale="zh" currentPath="/topics" />

src/pages/weekly/[slug].astro

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ function formatWeekDate(weekStr: string): string {
2828
<link rel="icon" href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><text y='.9em' font-size='90'>⚡</text></svg>" />
2929
<title>{post.data.title} | Awesome AI</title>
3030
<meta name="description" content={post.data.summary || post.data.title} />
31+
<script type="module">
32+
import mermaid from 'https://cdn.jsdelivr.net/npm/mermaid@10/dist/mermaid.esm.min.mjs';
33+
mermaid.initialize({ startOnLoad: true, theme: 'dark' });
34+
</script>
3135
</head>
3236
<body class="bg-bg text-text font-sans antialiased flex flex-col min-h-screen">
3337
<NavBar locale="zh" currentPath="/weekly" />

0 commit comments

Comments
 (0)