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

推荐订阅源

Martin Fowler
Martin Fowler
Engineering at Meta
Engineering at Meta
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
阮一峰的网络日志
阮一峰的网络日志
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
量子位
Jina AI
Jina AI
Microsoft Azure Blog
Microsoft Azure Blog
博客园_首页
L
LangChain Blog
A
About on SuperTechFans
人人都是产品经理
人人都是产品经理
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
美团技术团队
博客园 - 三生石上(FineUI控件)
N
Netflix TechBlog - Medium
D
DataBreaches.Net
P
Proofpoint News Feed
小众软件
小众软件
Vercel News
Vercel News
T
The Blog of Author Tim Ferriss
WordPress大学
WordPress大学
雷峰网
雷峰网
G
Google Developers Blog

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: