@barzhsieh/nuxt-content-mermaid
A Nuxt module designed for integrating Mermaid with `@nuxt/content`. It automatically converts `mermaid` code blocks in Markdown into responsive chart components, and supports lazy loading and dark/light theme switching.
20,535
16
| Install | |
|---|---|
npm install @barzhsieh/nuxt-content-mermaid |
|
| Latest Version: | 4.0.1 |
| Vue: | 3 |
| License: | MIT |
| Last Updated: | Oct 21, 2026 |
| Links: | GitHub · npm |
Maintainer: barzhsieh
nuxt-content-mermaid
@barzhsieh/nuxt-content-mermaid 會將 Nuxt Content Markdown 中的
mermaid 程式碼圍欄 (fence) 轉換為響應式、可互動的圖表,並支援延遲載入、深淺色
主題、工具列控制,以及由應用程式提供的渲染元件。
英文正式文件 是 canonical package documentation。本 README 是 npm 與 GitHub 的精簡發佈摘要; 繁體中文網站 為 best-effort translation,可能比英文內容稍晚同步。若兩者有差異,請以英文文件為準。
適用情境
當 Nuxt Content 應用程式需要下列能力時,可使用本模組:
- 在 Markdown 中以 Mermaid 程式碼圍欄 (fence) 撰寫圖表;
- 在瀏覽器中渲染圖表,並使用套件提供的載入與錯誤狀態;
- 跟隨應用程式的深色與淺色模式;
- 在全域、單一頁面或單一圍欄 (fence) 設定圖表;
- 選用延遲渲染、工具列控制或自訂渲染元件。
本模組管理相容的 Mermaid 版本;應用程式負責 Nuxt、Nuxt Content peer dependencies,以及 Nuxt Content database connector。
相容性
- Node.js
>=22.19.0 - Nuxt
^4.1.0 - Nuxt Content
>=3.5.0 <4.0.0 - ES2024 瀏覽器;Safari/iOS/iPadOS
17.4+
相依擁有權、v4 遷移邊界與渲染保證,請參閱 4.x 相依與遷移契約。
快速開始
安裝本模組與 Nuxt Content peer:
pnpm add @barzhsieh/nuxt-content-mermaid @nuxt/content
註冊模組:
export default defineNuxtConfig({
modules: ['@barzhsieh/nuxt-content-mermaid'],
})
接著在 Content Markdown 檔案中加入 Mermaid 圍欄:
```mermaid
flowchart LR
Markdown --> Content --> Mermaid --> SVG
```
Mermaid 已包含在本模組中,不需要另外安裝。資料庫 connector 選擇與完整的 第一個專案步驟,請參閱開始使用。
繁體中文文件
支持與貢獻
如果本模組對你有幫助,歡迎透過 Ko-fi 支持我的開源工作。
歡迎建立 Issue 或提交附有清楚摘要與測試結果的 Pull Request。維護者請遵循 stable release runbook。
授權
Related Packages
Version History
| Version | Released | License |
|---|---|---|
| 4.0.1 | MIT | |
| 4.0.0 | MIT | |
| 3.0.5 | MIT | |
| 3.0.4 | MIT | |
| 3.0.3 | MIT | |
| 3.0.2 | MIT | |
| 3.0.0 | MIT | |
| 2.2.3 | MIT | |
| 2.2.2 | MIT | |
| 2.2.1 | MIT | |
| 2.2.0 | MIT | |
| 2.1.3 | MIT | |
| 2.1.2 | MIT | |
| 2.1.1 | MIT | |
| 2.0.1 | MIT | |
| 2.0.0 | MIT | |
| 1.0.4 | MIT | |
| 1.0.3 | MIT | |
| 1.0.2 | MIT | |
| 1.0.1 | MIT | |
| 1.0.0 | MIT |
Pre-releases (2)
| Version | Released | License |
|---|---|---|
| 2.1.0-alpha.1 | MIT | |
| 2.1.0-alpha.0 | MIT |
