Install
openclaw skills install md2pdf-converterOffline Markdown to PDF converter with full Unicode support using Pandoc + WeasyPrint + local emoji cache. Converts Markdown documents to professional PDFs w...
openclaw skills install md2pdf-converterConvert Markdown documents to professional PDFs with FULL Unicode support, Chinese fonts, and colorful emojis (3660 emojis including all variants). Uses Pandoc + WeasyPrint with a local Twemoji cache to work offline after first run.
Convert a Markdown file to PDF:
bash scripts/md2pdf-local.sh input.md output.pdf
First run only: Downloads ~150MB emoji resources (Twemoji 14.0.0) from GitHub. Subsequent runs work offline.
Example:
bash scripts/md2pdf-local.sh report.md report.pdf
~/.cache/md2pdf/emojis/emoji_mapping.json)~/.cache/md2pdf/
├── emojis/ # 3660 colorful PNG files
│ ├── 0023-fe0f-20e3.png
│ ├── 1f600.png
│ └── ...
└── emoji_mapping.json # Emoji to filename mapping
{
"🙀": "1f600.png",
"⌛": "0023-fe0f-20e3.png",
...
}
The Python script generate_emoji_mapping.py scans all Twemoji files and creates a precise mapping from emoji characters to PNG filenames. This ensures accurate emoji replacement even for complex variants like skin tones and regional indicators.
Primary Chinese font: AR PL UMing CN
Fallback: Noto Sans SC, Noto Sans CJK SC, Microsoft YaHei
Monospace: Menlo, Monaco
If Chinese characters display incorrectly, ensure AR PL UMing CN is installed:
# Ubuntu/Debian
sudo apt-get install fonts-arphic-uming
# Check if installed
fc-list | grep "AR PL UMing"
ls ~/.cache/md2pdf/emojis/ls ~/.cache/md2pdf/emoji_mapping.jsonrm -rf ~/.cache/md2pdfls ~/.cache/md2pdf/emojis/1f600.pngThis issue has been FIXED in v2.0. If you still see black-and-white emojis:
Verify you're using the v2.0 script:
grep "TWEMOJI_VERSION" scripts/md2pdf-local.sh
# Should show: TWEMOJI_VERSION="14.0.0"
Clear cache and regenerate:
rm -rf ~/.cache/md2pdf
bash scripts/md2pdf-local.sh test.md test.pdf
Install missing dependencies:
# Ubuntu/Debian
sudo apt-get install python3-weasyprint
# Or via pip
pip3 install weasyprint
If generate_emoji_mapping.py fails:
# Check Python version
python3 --version
# Should be Python 3.6+
# Check emoji cache
ls ~/.cache/md2pdf/emojis
md2pdf-local.sh - Main conversion script with automatic emoji caching and mapping
generate_emoji_mapping.py - Python script to generate emoji lookup table
Usage: Direct execution from any location (uses absolute paths):
bash /path/to/skills/md2pdf-converter/scripts/md2pdf-local.sh input.md output.pdf
Key Features:
| Feature | v1.0 (Old) | v2.0 (New) |
|---|---|---|
| Emoji Source | emoji-datasource-google | Twemoji 14.0.0 |
| Emoji Count | ~2000-3000 | 3660 |
| Color Display | ❌ Unstable | ✅ Stable |
| Variants Support | ❌ Incomplete | ✅ Complete |
| Mapping Accuracy | ⚠️ Low | ✅ High |
| Offline Support | ✅ After first run | ✅ After first run |
| First Run Size | ~68MB | ~150MB |