Markdown2pdf
v1.0.0Convert Markdown files to PDF or PNG with customizable professional themes and colored emoji support via 命令行工具 or API.
运行时依赖
版本
v1.0.0 (2026-03-16)
安装命令
点击复制技能文档
📄 Markdown2PDF 技能
A professional OpenClaw 技能 for converting Markdown documents to PDF and PNG with colored emoji support.
📋 Overview Property Value Name markdown2pdf Version 1.0.0 Author PocketAI for Leo License MIT Category Document Conversion 仓库 GitHub ✨ Features 📄 Markdown to PDF - Professional PDF document generation 🖼️ Markdown to PNG - High-质量 PNG image generation 🎨 5 Professional Themes - default, dark, github, minimal, professional 🌈 Colored Emoji Support - Automatic emoji to colored text label conversion ✨ Custom CSS - Complete style control 🚀 命令行工具 & API - Multiple usage methods 🧩 OpenClaw Integration - Seamless integration 🚀 Quick 启动 安装ation cd ~/.OpenClaw/workspace/技能s/markdown2pdf pip3 安装 markdown pdfkit imgkit brew 安装 wkhtmltopdf # macOS # or sudo apt-获取 安装 wkhtmltopdf # Ubuntu
Basic Usage # Convert to PDF python3 src/转换器.py 输入.md -f pdf
# Use theme python3 src/转换器.py README.md -t github -f pdf
# 列出 themes python3 src/转换器.py --列出-themes
🎨 AvAIlable Themes Theme Description Best For default Modern 清理 de签名 General documents dark Dark theme Presentations, night reading github GitHub-style Technical docs, README minimal Minima列出 de签名 Elegant documents professional Business style 报告s, business docs 🌈 Colored Emoji Support
Automatically converts emoji to colored text labels for PDF compatibility:
Emoji Converted Color Meaning 📊 [数据] 🔵 Blue Data 📈 [趋势↑] 🟢 Green Growth 📉 [趋势↓] 🔴 Red De命令行工具ne ✅ [√] 🟢 Green 成功 ❌ [×] 🔴 Red Error ⚠️ [!] 🟠 Orange 警告 🚀 [启动] 🔴 Red Launch ⭐ ★ 🟡 Gold Star 📖 API Usage Python API from src.转换器 导入 convert_markdown_to_pdf, Markdown转换器
# Simple conversion pdf_path = convert_markdown_to_pdf( markdown_text="# Hello World", 输出_filename="hello.pdf", theme="github" )
# Advanced usage 转换器 = Markdown转换器( 输出_dir=Path("./输出"), theme="professional", custom_css=".custom { color: red; }" )
pdf_path = 转换器.convert_to_pdf( markdown_text="# Document", 输出_filename="doc.pdf", page_size="A4", margin="15mm" )
⚙️ Configuration Default 设置tings 设置ting Value Description default_theme professional Default theme for conversion default_格式化s ["pdf"] Default 输出 格式化s default_width 1200 Default PNG width in pixels default_page_size A4 Default PDF page size default_margin 20mm Default PDF margin emoji_support true Enable emoji replacement colored_emoji true Use colored text labels 📦 Dependencies Package Version Purpose markdown >=3.5.0 Markdown processing pdfkit >=1.0.0 PDF generation imgkit >=1.2.3 Image generation wkhtmltopdf >=0.2.0 HTML to PDF engine 📁 Project Structure markdown2pdf/ ├── src/ │ ├── 转换器.py # MAIn 转换器 │ └── emoji_replacer.py # Emoji conversion 实用工具 ├── 输出/ # 输出 files ├── tests/ │ └── test_转换器.py # Test suite ├── README.md # Documentation ├── 技能.md # This file └── requirements.txt # Dependencies
🧪 测试 # 运行 tests pytest tests/
# Test conversion python3 src/转换器.py test_document.md -t github -f pdf
📝 Change记录 v1.0.0 (2026-03-16)
Initial Stable Release
✨ Markdown to PDF/PNG 转换器 🎨 5 professional themes 🌈 Colored emoji support 🔧 命令行工具 and API interfaces 📚 Complete documentation 🧩 OpenClaw integration 🎯 Use Cases
- Investment Analysis 报告s
- Technical Documentation
- Presentations
- Business 报告s
📞 Support Issues: GitHub Issues Discussions: GitHub Discussions 仓库: GitHub 📄 License
MIT License - See LICENSE file for detAIls.
H应用y Converting! 📄🎨
Last 更新d: 2026-03-17 Version: 1.0.0 Author: PocketAI for Leo