feat: client-side Mermaid diagram rendering with interactive viewer

Render mermaid code blocks as SVG diagrams instead of syntax-highlighted
source code. Includes a full pan/zoom viewer with drag, scroll wheel zoom,
pinch-to-zoom, fit-to-view, and fullscreen support. Theme-aware (dark/light).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-20 12:29:53 +08:00
parent 6ac6ea5545
commit 08117a11c5
7 changed files with 1693 additions and 2 deletions

View File

@@ -12,6 +12,7 @@ import { SectionDivider } from '@/components/section-divider';
import { JsonLd } from '@/components/json-ld';
import { DevEnvDeviceHero } from '@/components/dev-env-device-hero';
import { HomeLabDeviceHero } from '@/components/homelab-device-hero';
import { MermaidRenderer } from '@/components/mermaid-renderer';
export function generateStaticParams() {
const params = allPages.map((page) => ({
@@ -137,6 +138,7 @@ export default async function StaticPage({ params }: Props) {
)
)}
<div dangerouslySetInnerHTML={{ __html: page.body.html }} />
<MermaidRenderer />
</article>
</ScrollReveal>
</SectionDivider>