
Security News
GitHub Actions Checkout Now Blocks Risky pull_request_target Checkouts
GitHub Actions checkout now blocks risky pull_request_target checkouts by default to help prevent pwn request supply chain attacks.
mermaid-docs-generator
Advanced tools
将Markdown文档转换为带有交互式Mermaid图表的HTML静态网页。
在线文档: https://luoleyan.github.io/mermaid-docs-generator/
npm install -g mermaid-docs-generator
npm install --save-dev mermaid-docs-generator
npx mermaid-docs init
这将创建基本的目录结构和配置文件。
npx mermaid-docs generate
npx mermaid-docs serve
初始化后,将创建以下目录结构:
项目根目录/
├── docs/ # Markdown文档目录
│ ├── structure/ # 结构图文档
│ ├── er/ # 实体关系图文档
│ ├── flowcharts/ # 流程图文档
│ └── ui/ # UI设计图文档
│
└── mermaid-docs.config.js # 配置文件
生成的HTML文档将默认输出到docs-html目录。
在mermaid-docs.config.js中可以配置以下选项:
module.exports = {
// 输入目录,包含Markdown文档
input: 'docs',
// 输出目录,生成的HTML文件
output: 'docs-html',
// 文档标题
title: '项目文档',
// 主题 (light, dark)
theme: 'light',
// 是否启用图表交互功能
interactive: true,
// 是否启用保存图片功能
saveImage: true,
// 文档分类
categories: [
{ id: 'structure', name: '结构图', path: 'structure' },
{ id: 'er', name: '实体关系图', path: 'er' },
{ id: 'flowcharts', name: '流程图', path: 'flowcharts' },
{ id: 'ui', name: 'UI设计图', path: 'ui' }
],
// 自定义模板(可选)
templates: {
// 自定义页面模板
// page: 'path/to/custom-template.html',
// 自定义样式
// styles: ['path/to/custom-style.css']
}
};
npx mermaid-docs init [options]
选项:
-d, --dir <dir>: 项目目录,默认为当前目录npx mermaid-docs generate [options]
选项:
-c, --config <path>: 配置文件路径,默认为mermaid-docs.config.js-i, --input <dir>: 输入目录,默认为docs-o, --output <dir>: 输出目录,默认为docs-html-t, --title <title>: 文档标题,默认为项目文档--theme <theme>: 主题 (light, dark),默认为light--no-interactive: 禁用图表交互功能--no-save-image: 禁用保存图片功能npx mermaid-docs serve [options]
选项:
-p, --port <port>: 端口号,默认为8080-d, --dir <dir>: 文档目录,默认为docs-html您可以通过在配置文件中指定自定义模板来更改文档的外观:
templates: {
// 自定义页面模板
page: 'templates/custom-page.html',
// 自定义首页模板
index: 'templates/custom-index.html',
// 自定义分类页面模板
category: 'templates/custom-category.html',
// 自定义样式
styles: ['templates/custom-style.css']
}
模板中可以使用以下变量:
{{title}}: 页面标题{{projectTitle}}: 项目标题{{content}}: 页面内容{{navLinks}}: 导航链接{{sidebarLinks}}: 侧边栏链接{{categoryCards}}: 分类卡片(仅在首页模板中){{fileCards}}: 文件卡片(仅在分类页面模板中){{cssLinks}}: CSS链接{{jsLinks}}: JavaScript链接{{theme}}: 主题名称MIT
FAQs
将Markdown文档转换为带有交互式Mermaid图表的HTML静态网页
We found that mermaid-docs-generator demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
GitHub Actions checkout now blocks risky pull_request_target checkouts by default to help prevent pwn request supply chain attacks.

Product
Socket now supports Custom Roles and Repository Access Permissions so organizations can control who can access specific repositories and actions.

Product
Socket MCP now lets AI assistants review org alerts, investigate threats using the Socket threat feed, and inspect package files in addition to dependency scoring.