md-to-pdf-advanced

Convert Markdown files to PDF with multiple backend options (WeasyPrint, Pandoc, wkhtmltopdf). Supports syntax highlighting, tables, images, custom CSS themes, and page styling. Use when converting Markdown (.md) to PDF, generating documents from markdown, creating PDF reports, or any markdown-to-pdf conversion task. Triggers on markdown to pdf, md to pdf, convert markdown pdf, generate pdf from markdown.

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 "md-to-pdf-advanced" with this command: npx skills add 20181112523/md-to-pdf-advanced

Markdown to PDF Converter

Convert Markdown files to PDF with professional formatting. Supports multiple backends for different use cases.

Backends

Primary: WeasyPrint (Pure Python)

  • Pros: No system dependencies, pip install only, good CSS support
  • Cons: Slightly slower on large documents
  • Use for: Most use cases, especially when you can't install system packages

Optional: Pandoc + wkhtmltopdf

  • Pros: Most powerful, LaTeX support, best typography
  • Cons: Requires system package installation
  • Use for: Academic papers, complex documents, LaTeX math

Quick Start

# Using WeasyPrint (recommended, auto-installed)
python3 scripts/md_to_pdf.py input.md output.pdf

# Using Pandoc (if installed)
python3 scripts/md_to_pdf.py input.md output.pdf --backend pandoc

Usage from Agent

Basic Conversion

# Convert markdown to PDF
exec("python3 skills/md-to-pdf-advanced/scripts/md_to_pdf.py /path/to/input.md /path/to/output.pdf")

With Custom CSS

# Apply custom theme
exec("python3 skills/md-to-pdf-advanced/scripts/md_to_pdf.py input.md output.pdf --css skills/md-to-pdf-advanced/assets/github-theme.css")

With Options

# Landscape, custom margins
exec("python3 skills/md-to-pdf-advanced/scripts/md_to_pdf.py input.md output.pdf --orientation landscape --margin 15mm")

Features

  • ✅ Syntax-highlighted code blocks
  • ✅ Tables with styling
  • ✅ Images (local and remote)
  • ✅ Headers and footers with page numbers
  • ✅ Custom CSS themes
  • ✅ Page size and orientation options
  • ✅ Adjustable margins

CSS Themes

Available in assets/:

  • github-theme.css - GitHub-like styling
  • minimal-theme.css - Clean minimal look
  • academic-theme.css - Academic paper style

Troubleshooting

WeasyPrint fails to install

# Install system dependencies first (Ubuntu/Debian)
sudo apt-get install python3-dev libffi-dev libxml2-dev libxslt1-dev

# Then install Python packages
pip3 install weasyprint markdown Pygments

Images not showing

Use absolute paths or ensure images are relative to the markdown file location.

Fonts look wrong

WeasyPrint uses system fonts. Install the fonts you reference in CSS:

# Ubuntu/Debian
sudo apt-get install fonts-liberation fonts-dejavu

# macOS
brew install --cask font-liberation

Emoji display as □ (boxes) or not rendered

PDF 中 emoji(如 ✅、🔄、📋)显示为方框是因为系统缺少彩色 Emoji 字体支持。

解决方案:

# 1. 安装 Google Noto Color Emoji 字体(支持全量 Unicode Emoji)
# Fedora/RHEL/CentOS
dnf install -y google-noto-emoji-color-fonts

# Ubuntu/Debian
sudo apt-get install fonts-noto-color-emoji

# 2. 刷新字体缓存让系统识别新字体
fc-cache -fv

# 3. 重新转换 PDF
python3 skills/md-to-pdf-advanced/scripts/md_to_pdf.py input.md output.pdf

替代方案(如果不想安装字体):

将 Markdown 中的 emoji 替换为文字描述或 ASCII 符号:

Emoji文字替代ASCII 替代
[OK](完成)[x]
[FAIL](失败)[ ]
🔄[更新](刷新)~>
📋[列表](任务)[#]
⚠️[警告](注意)!
💡[提示](建议)i
🔧[修复](工具)`
🐛[BUG](缺陷)*

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

Multi Edge-TTS CN

Edge-TTS 在线语音合成 skill。基于微软 Edge TTS 引擎,生成速度快(1-2秒),支持多种音色和输出格式。同时支持飞书(OGG/Opus)和企业微信(AMR)。默认音色 xiaoxiao_lively。需联网。

Registry SourceRecently Updated
General

vedic-destiny

吠陀命盘分析中文入口。用于完整命盘研判、命主盘 Rashi chart 与九分盘 Navamsha chart 联读、既往事件回看、出生时间稳定度判断、事业主题、婚姻主题、时空盘专题,以及基于 Jagannatha Hora PDF、星盘截图或文本命盘数据的系统拆盘。当用户提到完整星盘、事业方向、婚姻问题、关系窗...

Registry SourceRecently Updated
General

One Person Company OS

Build a visual operating cockpit for an AI-native one-person company across promise, buyer, product, delivery, cash, learning, and assets. / 为 AI 一人公司建立可视化经营...

Registry SourceRecently Updated
General

健康追踪

健康追踪技能 - 追踪饮水、睡眠、步数等健康数据,JSON存储。

Registry SourceRecently Updated