← 返回 Skills 市场
fireium

Markdown Diagram Renderer

作者 fireium · GitHub ↗ · v1.0.3 · MIT-0
cross-platform ✓ 安全检测通过
234
总下载
1
收藏
1
当前安装
4
版本数
在 OpenClaw 中安装
/install markdown-diagram-renderer
功能描述
Automatically identify diagram code blocks (Mermaid/Graphviz/PlantUML) in Markdown documents, render them as images, and replace them.
使用说明 (SKILL.md)

Markdown Diagram Renderer

Automatically identify architecture/flowchart code blocks in Markdown documents, render them as images, and replace them.

Features

  • Smart Identification: Automatically identify Mermaid, Graphviz, and PlantUML diagrams without specific language tags.
  • Multi-backend Rendering: Supports local rendering and online API fallback.
  • Base64 Inline: Images are inlined into Markdown as Base64 encoding, version control friendly.
  • Source Preservation: Optionally keep the original diagram code as comments.

Supported Diagram Types

Diagram Type Language Identifier Local Renderer Online Renderer
Mermaid mermaid, mmd mmdc CLI mermaid.ink
Graphviz graphviz, dot, gv graphviz Python -
PlantUML plantuml, puml Java jar plantuml.com

Getting Started

Before first use, please install Python dependencies:

# Install dependencies
pip install -r {baseDir}/script/requirements.txt

Optional dependencies (install as needed):

# Mermaid local rendering (recommended)
npm install -g @mermaid-js/mermaid-cli

# Graphviz (for Graphviz diagrams)
# macOS: brew install graphviz
# Ubuntu: sudo apt-get install graphviz

# PlantUML local rendering
# 1. Install Java
# 2. Download plantuml.jar
# 3. Set environment variable: export PLANTUML_JAR=/path/to/plantuml.jar

Note: If local rendering tools are not installed, the system will automatically use online APIs for rendering (requires internet connection).

⚠️ Privacy Warning: Online rendering sends diagram source code to third-party services:

  • Mermaid → mermaid.ink
  • PlantUML → plantuml.com

Do not include sensitive information (e.g., passwords, keys, internal architecture details) in diagrams. It is recommended to install local rendering tools to avoid data leakage.

Usage

CLI Command Line

# Basic usage
python3 {baseDir}/script/main.py document.md

# Specify output file
python3 {baseDir}/script/main.py document.md -o output.md

# Set confidence threshold
python3 {baseDir}/script/main.py document.md --threshold 0.7

# Output SVG format
python3 {baseDir}/script/main.py document.md --format svg

# Do not preserve source code
python3 {baseDir}/script/main.py document.md --no-preserve

# Detailed logs
python3 {baseDir}/script/main.py document.md -v

Calling as a Python Module

import sys
sys.path.insert(0, '{baseDir}/script')

from main import create_skill

# Create SKILL instance
config = {
    'confidence_threshold': 0.6,
    'output_format': 'png',
    'preserve_source': True,
}
skill = create_skill(config)

# Execute
result = skill.execute(
    input_file='document.md',
    output_file='output.md'
)

print(result)

Configuration Parameters

Parameter Type Default Description
confidence_threshold float 0.6 Diagram identification confidence threshold (0-1)
output_format string png Output image format (png/svg)
preserve_source bool True Whether to preserve original diagram code

Identification Strategy

Uses a multi-stage filter system:

  1. Language Tag Check: Prioritizes identifying mermaid, graphviz, plantuml, etc.
  2. First Line Keyword Matching: Checks for typical declarations at the beginning of code blocks.
  3. Keyword Density Analysis: Counts the frequency of diagram-specific keywords.
  4. Structural Feature Analysis: Detects structural characteristics of diagrams.

Output Example

Before processing:

```mermaid
graph TD
    A[Start] --> B[Process]
    B --> C[End]
```

After processing:

![mermaid diagram](data:image/png;base64,iVBORw0KGgo...)

\x3C!-- Original diagram code -->
\x3C!--
```mermaid
graph TD
    A[Start] --> B[Process]
    B --> C[End]

-->


## File Structure

{baseDir}/ ├── SKILL.md # This file ├── script/ │ ├── main.py # Main entry point │ ├── core.py # Core logic │ └── requirements.txt # Python dependencies └── README.md # Detailed documentation

安全使用建议
This skill appears to do what it says: it finds diagram code blocks and renders them using local tools if available or by calling public rendering services. Before installing or running: (1) be aware that fallback rendering will send diagram source to third‑party services (mermaid.ink, plantuml.com) — do not include secrets or sensitive architecture details if you rely on online rendering; (2) if you want to avoid remote calls, install local renderers (mmdc, Graphviz, Java + plantuml.jar) and set PLANTUML_JAR appropriately; (3) the skill will execute local binaries (mmdc, java, graphviz) via subprocess — only use it in environments where you trust those binaries and the skill source; (4) there is no automated installer in the registry — run pip install -r script/requirements.txt yourself and consider testing on a copy of files (use -o) to avoid accidental overwrite. If you want extra assurance, review script/core.py and script/main.py locally or run the tool in an isolated environment first.
功能分析
Type: OpenClaw Skill Name: markdown-diagram-renderer Version: 1.0.3 The bundle is a legitimate utility for rendering Markdown diagrams (Mermaid, Graphviz, PlantUML) into Base64-encoded images. It uses standard libraries like mistletoe for parsing and provides local rendering via subprocess calls to mmdc or Java, with documented fallbacks to public APIs (mermaid.ink and plantuml.com). The code in script/core.py and script/main.py is well-structured, lacks obfuscation, and includes explicit privacy warnings in SKILL.md regarding the use of online renderers.
能力评估
Purpose & Capability
Name and description match the included code and README: the detector, renderer, and processor implement identification and rendering of Mermaid/Graphviz/PlantUML diagrams. Optional dependencies (mmdc, java, graphviz) are appropriate for the described backends.
Instruction Scope
SKILL.md and README instruct the agent/user to install Python deps and optional local renderers, and show CLI/module usage. The instructions and code operate on supplied Markdown files and temporary files only. Note: the skill falls back to online rendering APIs (mermaid.ink, plantuml.com) and explicitly warns about sending diagram source to those services.
Install Mechanism
There is no automated install spec in the registry; the README/SKILL.md ask the user to run 'pip install -r script/requirements.txt' and optionally install npm/java/graphviz. This is reasonable but means the user must perform dependency installation manually. No downloads from untrusted URLs or extract/install steps were present in the registry metadata.
Credentials
The skill requires only python3; no required environment variables or credentials. An optional PLANTUML_JAR env var is documented and justified for local PlantUML rendering. No unrelated secrets or config paths are requested.
Persistence & Privilege
The skill is not always:true and does not request persistent platform privileges. It reads/writes the user-specified Markdown file(s) and creates temporary files. It does not modify other skills or system-wide configs.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install markdown-diagram-renderer
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /markdown-diagram-renderer 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.3
- SKILL documentation rewritten from Chinese to English for broader accessibility. - All instructions, descriptions, usage examples, and configuration details now provided in English. - No functional or behavioral changes to the skill itself—documentation update only.
v1.0.2
- Initial release of markdown-diagram-renderer. - Added core logic for detecting and rendering Mermaid, Graphviz, and PlantUML diagrams in Markdown files. - Images are rendered (locally or via online API), then encoded as Base64 and inlined in the Markdown. - Original diagram source code optionally preserved as comments. - Provides command-line interface and Python module usage. - Includes documentation and dependency specifications.
v1.0.1
- Removed all core implementation and documentation files: script/core.py, script/main.py, script/requirements.txt, and README.md. - SKILL.md and metadata modified to include privacy warnings and mark external binaries/environments as optional. - The skill is now effectively a placeholder, with no executable functionality or documentation remaining.
v1.0.0
Initial release of md-diagram-renderer. - Automatically detects diagram code blocks (Mermaid, Graphviz, PlantUML) in Markdown and renders them as embedded images. - Supports both local rendering (via CLI tools) and online API fallback. - Outputs images as Base64 inline for version control friendliness. - Optional retention of original diagram code as comments. - Usable via CLI or as a Python module with configurable parameters.
元数据
Slug markdown-diagram-renderer
版本 1.0.3
许可证 MIT-0
累计安装 1
当前安装数 1
历史版本数 4
常见问题

Markdown Diagram Renderer 是什么?

Automatically identify diagram code blocks (Mermaid/Graphviz/PlantUML) in Markdown documents, render them as images, and replace them. 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 234 次。

如何安装 Markdown Diagram Renderer?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install markdown-diagram-renderer」即可一键安装,无需额外配置。

Markdown Diagram Renderer 是免费的吗?

是的,Markdown Diagram Renderer 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

Markdown Diagram Renderer 支持哪些平台?

Markdown Diagram Renderer 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 Markdown Diagram Renderer?

由 fireium(@fireium)开发并维护,当前版本 v1.0.3。

💬 留言讨论