惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Google DeepMind News
Google DeepMind News
L
LangChain Blog
H
Help Net Security
博客园_首页
T
Tailwind CSS Blog
Microsoft Security Blog
Microsoft Security Blog
T
The Blog of Author Tim Ferriss
雷峰网
雷峰网
Recent Announcements
Recent Announcements
D
DataBreaches.Net
U
Unit 42
Vercel News
Vercel News
I
InfoQ
Martin Fowler
Martin Fowler
Microsoft Azure Blog
Microsoft Azure Blog
Apple Machine Learning Research
Apple Machine Learning Research
S
SegmentFault 最新的问题
Jina AI
Jina AI
博客园 - 叶小钗
博客园 - 【当耐特】
罗磊的独立博客
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
月光博客
月光博客
Last Week in AI
Last Week in AI

Bboysoul's Blog

博客主题更新:现在支持 Mermaid 了 I Recreated My Own Version of TickTick with AI 我用 AI 复刻了一个自己的 TickTick Blog Theme Update Easier-to-Read Articles and Code Blocks 博客主题更新:更好读的文章页和代码块 Building a Personal Manga Library with Komga 用 Komga 搭一个自己的漫画库 Deploying LiteLLM on Kubernetes 在Kubernetes中部署LiteLLM 20260902的胡言乱语 Random Thoughts - 20260902 Introduction Finger 介绍下Finger How I Use Hermes 我是怎么用 Hermes 的 Whey Protein and Creatine 蛋白粉和肌酸 20260811的胡言乱语 Random Thoughts - 20260811 在 K8s 里搭建 WireGuard VPN 并访问集群网络 20260728的胡言乱语 Random Thoughts - 20260728 夏天来杯黄瓜柠檬水 Cloudflare 提交工单的迷宫——你得把所有下拉菜单点开才算完 聊聊 -XX:MaxRAMPercentage=75% 20260715的胡言乱语 Random Thoughts - 20260715 20260714的胡言乱语 Random Thoughts - 20260714 Random Thoughts - 20260708
Blog Theme Update Mermaid Support Is Here
2026-09-17 · via Bboysoul's Blog

Introduction

The blog theme now supports Mermaid. From now on, I can put flowcharts, sequence diagrams, and simple architecture diagrams directly into Markdown. No more drawing a diagram, exporting it, uploading it, and then coming back to add the link.

This post also doubles as a quick test of the new feature.

What Changed

  • Added a Hugo render hook for Mermaid code blocks
  • Mermaid CSS and JavaScript only load when a post actually contains a Mermaid diagram
  • Pinned Mermaid to 12.0.0, so an upstream CDN update will not suddenly break compatibility
  • Diagrams follow the system dark mode setting
  • Wide diagrams can scroll horizontally on phones instead of pushing the article outside the screen
  • If rendering fails, the Mermaid source stays visible instead of disappearing

How to Use It

It works like a normal fenced code block. Just use mermaid as the language:

```mermaid
flowchart LR
    A[Write Mermaid] --> B[Build with Hugo]
    B --> C[Render SVG in the browser]
```

Here is the actual result:

flowchart LR
    A[Write Mermaid] --> B[Build with Hugo]
    B --> C[Render SVG in the browser]

Why Add It Now

Most diagrams on this blog used to be drawn and uploaded as images. That is reliable, but changing even one word means exporting and uploading the image again. It feels like too much work for a small flowchart.

Mermaid fits diagrams that need to stay close to the article. The source lives right inside the Markdown file, changing nodes or connections is quick, and Git can show exactly what changed.

It will not replace every image. I will still use proper diagram tools for complex architecture diagrams or anything that needs careful layout. Mermaid is mainly for flowcharts, call chains, and state transitions that are simple and likely to change.

Loading It Only When Needed

I did not make every post on the site load Mermaid. During the Hugo build, the theme checks whether the article contains a Mermaid code block and only adds the related assets when needed.

Normal posts stay untouched. Posts that need a diagram do not need any extra front matter or configuration either. A mermaid code block is enough.

Feel free to follow my blog at www.bboy.app

Have Fun


Tags: