Install
openclaw skills install md-converterConvert Markdown (.md) files to Word (.docx), PDF, and styled HTML in one shot. Use when the user asks to: "md 转 Word", "Markdown 转 PDF", "md 转 HTML", "Markdown 生成文档", "把 md 文件转成 docx/pdf/html", or wants to convert a Markdown file to a viewable/shared document format. Supports Chinese (CJK) text with PingFang/SimHei fonts.
openclaw skills install md-converterConvert a Markdown (.md) file to Word (.docx), PDF, and/or styled HTML.
在使用本 skill 前,需要先安装 Python 依赖:
python3 -m pip install python-docx reportlab
python -m pip install python-docx reportlab
如果遇到权限问题,加 --user:python3 -m pip install --user python-docx reportlab
注意: PDF 脚本使用 reportlab,首次安装可能耗时 10-30 秒。HTML 脚本无外部依赖,可直接运行。
python3 -c "import docx, reportlab; print('OK')"
输出 OK 表示依赖已就绪。
python-docx)reportlab)convert_all.py runs all three formats at onceRefer to the system's available Python runtimes. Prefer python3 — it works on macOS/Linux.
On Windows, use python if python3 is unavailable.
If the user reports errors, install dependencies as described in the 安装与设置 section above.
Choose the appropriate script based on what the user wants:
| User says | Run |
|---|---|
| "转成 HTML" / "只需要网页版" | python3 scripts/md_to_html.py <input.md> |
| "转成 Word" / "生成 docx" | python3 scripts/md_to_docx.py <input.md> |
| "转成 PDF" | python3 scripts/md_to_pdf.py <input.md> |
| "全转" / "都要" / 没说具体格式 | python3 scripts/convert_all.py <input.md> |
Each script accepts an optional second argument for the output path:
python3 scripts/md_to_html.py input.md output.html
python3 scripts/md_to_docx.py input.md output.docx
python3 scripts/md_to_pdf.py input.md output.pdf
python3 scripts/convert_all.py input.md /path/to/output/dir/
After conversion:
deliver_attachments to send all generated files to the user| Feature | HTML | DOCX | |
|---|---|---|---|
| Headings (h1-h4) | ✓ | ✓ | ✓ |
| Bold / Italic | ✓ | ✓ | ✓ |
| Inline code | ✓ | ✓ | ✓ |
| Code blocks | ✓ | ✓ | ✓ |
| Unordered lists | ✓ | ✓ | ✓ |
| Ordered lists | ✓ | ✓ | ✓ |
| Tables | ✓ | ✓ | ✓ |
| Links | ✓ | ✓ | ✓ |
| Horizontal rules | ✓ | ✓ | ✓ |
| Blockquotes | ✓ | ✗ | ✗ |
Q: 报错 "No module named 'docx'"
→ 运行 python3 -m pip install python-docx
Q: PDF 中文显示为方块 → 脚本会自动检测系统字体。macOS 用 PingFang,Windows 用 SimHei。如果字体缺失,安装对应中文字体即可。
Q: Windows 上 python3 不存在
→ 用 python 代替 python3。确认已安装 Python 3.7+ 并加入 PATH。