← 返回 Skills 市场
karlzhu-zxc

md-pdf

作者 Karl Zhu · GitHub ↗ · v1.0.1 · MIT-0
cross-platform ✓ 安全检测通过
184
总下载
0
收藏
0
当前安装
2
版本数
在 OpenClaw 中安装
/install md-pdf
功能描述
Convert Markdown to polished PDF using Pandoc + XeLaTeX for print-quality or browser rendering with emoji and CSS support for rich visuals.
使用说明 (SKILL.md)

md2pdf

Produce polished, print-ready PDF from Markdown with a stable, reusable pipeline.

Quick start

  1. Install dependencies (Ubuntu/Debian):
    • bash scripts/install_deps_ubuntu.sh
  2. Convert standard formal Markdown with Pandoc/XeLaTeX:
    • bash scripts/md2pdf.sh input.md output.pdf
  3. Convert emoji-heavy or browser-like Markdown with CDP browser rendering:
    • bash scripts/md2pdf-browser.sh input.md output.pdf
  4. Optional: enable cover page / metadata style via defaults:
    • bash scripts/md2pdf.sh input.md output.pdf --defaults assets/defaults/hifi.yaml

Workflow

1) Choose the pipeline

Use the LaTeX pipeline when the document is mostly text/tables and should look print-formal.

Use the browser pipeline when any of these are true:

  • emoji must render correctly
  • HTML/CSS-like appearance matters more than TeX typography
  • the Markdown contains GitHub-style formatting that is easier to preserve in HTML
  • a CDP browser endpoint is already available

2) Prepare source markdown

  • Prefer #/## heading hierarchy (for TOC quality).
  • Keep code blocks fenced with language tags (for syntax highlight).
  • Keep tables in GFM format.
  • For very wide tables, prefer shorter cell content or convert the summary table to bullets before export.

3) Run the formal print pipeline

Use scripts/md2pdf.sh as the default entrypoint for print-style output.

It applies a professional baseline:

  • --pdf-engine=xelatex
  • Chinese font fallback (Noto Sans CJK SC)
  • Table of contents (--toc)
  • Section numbering (--number-sections)
  • Reasonable margins / line spread / link coloring
  • Code highlight style

4) Run the emoji-friendly browser pipeline

Use scripts/md2pdf-browser.sh when emoji support matters.

It does this:

  • render Markdown to HTML
  • convert emoji to Twemoji images
  • connect to an existing CDP browser (BROWSER_CDP_URL or http://127.0.0.1:9222)
  • print the page to PDF with browser CSS

Example:

  • BROWSER_CDP_URL=http://192.168.1.30:9222 bash scripts/md2pdf-browser.sh input.md output.pdf

5) Tune output quality

Use either:

  • CLI flags in scripts/md2pdf.sh (quick tuning), or
  • defaults file (assets/defaults/hifi.yaml) for stable team-wide style.

Recommended adjustments:

  • business report: keep 11pt, margin 2.2cm, TOC on
  • printable manual: increase margin to 2.5cm
  • dense technical doc: keep section numbers and monospace code font
  • emoji-heavy travel/share docs: prefer browser pipeline first

Troubleshooting

  • pandoc: command not found: run scripts/install_deps_ubuntu.sh.
  • xelatex not found: ensure texlive-xetex installed, or switch to scripts/md2pdf-browser.sh.
  • Emoji missing in PDF: use scripts/md2pdf-browser.sh; TeX engines are often poor at color emoji.
  • CJK glyph squares/tofu: install fonts-noto-cjk and keep CJKmainfont as Noto Sans CJK.
  • Browser script cannot connect: pass a valid CDP URL as arg 3 or set BROWSER_CDP_URL.
  • Weird table wrapping: reduce table width in markdown or use bullets for wide summary tables.

References

  • Style baseline and knobs: references/style-guide.md
  • Reusable defaults preset: assets/defaults/hifi.yaml
安全使用建议
This skill appears to do what it says, but consider these practical cautions before installing: 1) The browser pipeline can connect to any CDP URL you provide—avoid pointing it at remote or untrusted browsers because a connected CDP can expose browser state (tabs, cookies, etc.). Prefer a local Chrome instance (http://127.0.0.1:9222). 2) The npm dependencies are installed at runtime with `npm install` (no lockfile); standard supply-chain risks apply—inspect package.json and run in an isolated environment if you have strict security requirements. 3) The installer will run apt-get and requires sudo/root; review the install script if you must limit package installs. If those points are acceptable, the skill is coherent with its description.
功能分析
Type: OpenClaw Skill Name: md-pdf Version: 1.0.1 The skill bundle provides a legitimate utility for converting Markdown files to PDF using either Pandoc/XeLaTeX or a Puppeteer-based browser rendering pipeline. The scripts (scripts/md2pdf.sh, scripts/md2pdf_browser.js) are well-structured, use standard dependencies like 'marked' and 'puppeteer-core', and perform expected file operations. While the dependency installer (scripts/install_deps_ubuntu.sh) requires sudo privileges to install system packages, its actions are transparent and consistent with the tool's requirements. No evidence of data exfiltration, malicious persistence, or prompt injection was found.
能力评估
Purpose & Capability
Name/description match the implementation: pandoc/xelatex pipeline (scripts/md2pdf.sh) and a browser-based pipeline (scripts/md2pdf-browser.sh + md2pdf_browser.js) are present. Required binaries and packages (pandoc, xelatex, node/npm, puppeteer-core, marked, twemoji) are appropriate for the stated functionality.
Instruction Scope
SKILL.md instructs the agent to run the included scripts and to provide an input markdown file; runtime code only reads the input file, renders to HTML, and prints to PDF. The browser pipeline does connect to a CDP endpoint (configurable via BROWSER_CDP_URL), which is explicitly documented and required for that pipeline.
Install Mechanism
There is no platform install spec in the registry; the repo includes an Ubuntu installer script that apt-installs pandoc/texlive/fonts/node/npm and the npm dependencies are installed at runtime via `npm install`. This is expected but carries normal package-manager and supply-chain risk (unlocked npm install). No obscure download URLs or extract-from-unknown-server steps are used; twemoji assets come from the public jsDelivr CDN.
Credentials
The skill does not require any declared credentials or config paths. The only optional environment variable referenced is BROWSER_CDP_URL to point the browser pipeline at a CDP endpoint, which is justified by the pipeline design.
Persistence & Privilege
The skill does not request persistent/always-on privileges and does not modify other skills or global agent config. Autonomous invocation is allowed by platform default but is not combined with unusual privileges here.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install md-pdf
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /md-pdf 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.1
- Removed package-lock.json from the repository. - No changes to the skill's functionality or documentation.
v1.0.0
- Initial release of md2pdf. - Provides two Markdown to PDF pipelines: Pandoc + XeLaTeX for print-quality outputs, and browser-rendered HTML/Twemoji for emoji or WYSIWYG-friendly PDFs. - Strong support for Chinese/CJK text and robust table of contents/section numbering. - Special handling for emoji to ensure they survive PDF export. - Includes quick start instructions, workflow guidance, and detailed troubleshooting.
元数据
Slug md-pdf
版本 1.0.1
许可证 MIT-0
累计安装 0
当前安装数 0
历史版本数 2
常见问题

md-pdf 是什么?

Convert Markdown to polished PDF using Pandoc + XeLaTeX for print-quality or browser rendering with emoji and CSS support for rich visuals. 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 184 次。

如何安装 md-pdf?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install md-pdf」即可一键安装,无需额外配置。

md-pdf 是免费的吗?

是的,md-pdf 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

md-pdf 支持哪些平台?

md-pdf 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 md-pdf?

由 Karl Zhu(@karlzhu-zxc)开发并维护,当前版本 v1.0.1。

💬 留言讨论