← 返回
未分类 中文

Markdown2pdf

Convert Markdown files to PDF or PNG with customizable professional themes and colored emoji support via CLI or API.
Convert Markdown files to PDF or PNG with customizable professional themes and colored emoji support via CLI or API.
leohuang8688 leohuang8688 来源
未分类 clawhub v2.1.2 1 版本 100000 Key: 无需
★ 0
Stars
📥 548
下载
💾 0
安装
1
版本
#latest

概述

📄 Markdown2PDF Skill

A professional OpenClaw skill for converting Markdown documents to PDF and PNG with colored emoji support.


📋 Overview

PropertyValue
-----------------
Namemarkdown2pdf
Version1.0.0
AuthorPocketAI for Leo
LicenseMIT
CategoryDocument Conversion
RepositoryGitHub

✨ Features

  • 📄 Markdown to PDF - Professional PDF document generation
  • 🖼️ Markdown to PNG - High-quality 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
  • 🚀 CLI & API - Multiple usage methods
  • 🧩 OpenClaw Integration - Seamless integration

🚀 Quick Start

Installation

cd ~/.openclaw/workspace/skills/markdown2pdf
pip3 install markdown pdfkit imgkit
brew install wkhtmltopdf  # macOS
# or
sudo apt-get install wkhtmltopdf  # Ubuntu

Basic Usage

# Convert to PDF
python3 src/converter.py input.md -f pdf

# Use theme
python3 src/converter.py README.md -t github -f pdf

# List themes
python3 src/converter.py --list-themes

🎨 Available Themes

ThemeDescriptionBest For
------------------------------
defaultModern clean designGeneral documents
darkDark themePresentations, night reading
githubGitHub-styleTechnical docs, README
minimalMinimalist designElegant documents
professionalBusiness styleReports, business docs

🌈 Colored Emoji Support

Automatically converts emoji to colored text labels for PDF compatibility:

EmojiConvertedColorMeaning
----------------------------------
📊[数据]🔵 BlueData
📈[趋势↑]🟢 GreenGrowth
📉[趋势↓]🔴 RedDecline
[√]🟢 GreenSuccess
[×]🔴 RedError
⚠️[!]🟠 OrangeWarning
🚀[启动]🔴 RedLaunch
🟡 GoldStar

📖 API Usage

Python API

from src.converter import convert_markdown_to_pdf, MarkdownConverter

# Simple conversion
pdf_path = convert_markdown_to_pdf(
    markdown_text="# Hello World",
    output_filename="hello.pdf",
    theme="github"
)

# Advanced usage
converter = MarkdownConverter(
    output_dir=Path("./output"),
    theme="professional",
    custom_css=".custom { color: red; }"
)

pdf_path = converter.convert_to_pdf(
    markdown_text="# Document",
    output_filename="doc.pdf",
    page_size="A4",
    margin="15mm"
)

⚙️ Configuration

Default Settings

SettingValueDescription
-----------------------------
default_themeprofessionalDefault theme for conversion
default_formats["pdf"]Default output formats
default_width1200Default PNG width in pixels
default_page_sizeA4Default PDF page size
default_margin20mmDefault PDF margin
emoji_supporttrueEnable emoji replacement
colored_emojitrueUse colored text labels

📦 Dependencies

PackageVersionPurpose
---------------------------
markdown>=3.5.0Markdown processing
pdfkit>=1.0.0PDF generation
imgkit>=1.2.3Image generation
wkhtmltopdf>=0.2.0HTML to PDF engine

📁 Project Structure

markdown2pdf/
├── src/
│   ├── converter.py          # Main converter
│   └── emoji_replacer.py     # Emoji conversion utility
├── output/                    # Output files
├── tests/
│   └── test_converter.py     # Test suite
├── README.md                  # Documentation
├── SKILL.md                   # This file
└── requirements.txt           # Dependencies

🧪 Testing

# Run tests
pytest tests/

# Test conversion
python3 src/converter.py test_document.md -t github -f pdf

📝 Changelog

v1.0.0 (2026-03-16)

Initial Stable Release

  • ✨ Markdown to PDF/PNG converter
  • 🎨 5 professional themes
  • 🌈 Colored emoji support
  • 🔧 CLI and API interfaces
  • 📚 Complete documentation
  • 🧩 OpenClaw integration

🎯 Use Cases

1. Investment Analysis Reports

python3 src/converter.py stock_analysis.md -t professional -f pdf

2. Technical Documentation

python3 src/converter.py README.md -t github -f pdf,png

3. Presentations

python3 src/converter.py presentation.md -t dark -f png --width 1920

4. Business Reports

python3 src/converter.py business_report.md -t professional -f pdf

📞 Support


📄 License

MIT License - See LICENSE file for details.


Happy Converting! 📄🎨


Last Updated: 2026-03-17

Version: 1.0.0

Author: PocketAI for Leo

版本历史

共 1 个版本

  • v2.1.2 当前
    2026-05-01 23:27 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

office-efficiency

Word / DOCX

ivangdavila
创建、检查和编辑 Microsoft Word 文档及 DOCX 文件,支持样式、编号、修订记录、表格、分节符及兼容性检查等功能。
★ 475 📥 157,339
ai-agent

Self Improving Agent

leohuang8688
OpenClaw自改进代理系统,支持从交互、错误及恢复中持续学习,自动优化性能。
★ 0 📥 1,074
office-efficiency

Excel / XLSX

ivangdavila
创建、检查和编辑 Microsoft Excel 工作簿及 XLSX 文件,支持可靠的公式、日期、类型、格式、重算及模板保留功能。
★ 399 📥 149,549