Mermaid Image Uploader

# Mermaid 图片生成与图床上传技能

Safety Notice

This listing is from the official public ClawHub registry. Review SKILL.md and referenced scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "Mermaid Image Uploader" with this command: npx skills add coder-knock/mermaid-image-uploader

Mermaid 图片生成与图床上传技能

将 Mermaid 图表转换为图片并上传到免费图床,专为公众号文章设计。

功能特性

  • 🎨 将 Mermaid 代码转换为高质量图片
  • ☁️ 支持多个免费图床上传
  • 🔗 自动返回图片 URL
  • 📝 批量处理 Markdown 文件中的 Mermaid 图表
  • 🖼️ 支持多种图片格式 (PNG, SVG, JPG)

快速开始

安装依赖

pip install mermaid-cli requests

或者安装 Node.js 的 mermaid-cli:

npm install -g @mermaid-js/mermaid-cli

使用方法

# 转换单个 Mermaid 文件
python mermaid_uploader.py --input diagram.mmd --output diagram.png

# 转换 Markdown 文件中的所有 Mermaid 图表
python mermaid_uploader.py --markdown article.md --upload

# 指定图床
python mermaid_uploader.py --input diagram.mmd --image-host imgur

支持的图床

图床需要API Key特点
Imgur稳定,国外
FreeImage.host免费,国内访问快
Postimages简单易用
Cloudinary功能强大

文件结构

skills/mermaid-image-uploader/
├── SKILL.md                    # 本文件
├── package.json                # 技能配置
├── README.md                   # 详细说明
├── mermaid_uploader.py         # 主程序
├── mermaid_converter.py        # Mermaid 转换器
├── image_host_uploader.py      # 图床上传器
└── examples/                   # 示例
    ├── sample_diagram.mmd
    └── sample_article.md

使用示例

1. 转换单个 Mermaid 图表

from mermaid_uploader import MermaidUploader

uploader = MermaidUploader()

# 转换并上传
url = uploader.convert_and_upload(
    mermaid_code="""
    graph LR
        A[开始] --> B[处理]
        B --> C[结束]
    """,
    image_host="freeimage"
)

print(f"图片URL: {url}")

2. 处理 Markdown 文件

from mermaid_uploader import MarkdownProcessor

processor = MarkdownProcessor()

# 处理文件,替换所有 Mermaid 为图片链接
processor.process_file("article.md", "article_with_images.md")

命令行参数

--input, -i      输入的 Mermaid 文件
--output, -o     输出的图片文件
--markdown, -m   处理的 Markdown 文件
--upload, -u     是否上传到图床
--image-host     指定图床 (imgur, freeimage, postimages)
--format, -f     输出格式 (png, svg, jpg)
--api-key        图床 API Key

欢迎关注

欢迎关注微信公众号:拿客

获取更多技术干货和开源工具分享!

许可证

MIT License

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

General

M3U8 Downloader

Download encrypted m3u8/HLS videos using parallel downloads. Use when given an m3u8 URL to download a video, especially encrypted HLS streams with AES-128.

Registry SourceRecently Updated
General

Data Analyst Cn

数据分析助手 - 数据清洗、统计分析、可视化建议。适合:数据分析师、产品经理、运营。

Registry SourceRecently Updated
General

QuantumOS

Install and manage QuantumOS, an AI command center dashboard for OpenClaw. Use when the user wants to set up QuantumOS, start/stop the dashboard, troubleshoo...

Registry SourceRecently Updated