← 返回 Skills 市场
zhuleikiro222

md-to-pdf

作者 zhuleiKiro222 · GitHub ↗ · v1.0.0 · MIT-0
cross-platform ✓ 安全检测通过
51
总下载
1
收藏
0
当前安装
1
版本数
在 OpenClaw 中安装
/install zl-md-to-pdf
功能描述
Use when converting markdown files to PDF with styling, code highlighting, and CJK support
使用说明 (SKILL.md)

MD to PDF Conversion

Overview

Converts markdown files to styled PDF documents using Node.js, marked, and puppeteer-core. Supports Chinese/CJK text, code syntax highlighting, tables, and images.

When to Use

  • User asks to convert a .md file to PDF
  • Need to generate a printable document from markdown
  • Creating offline documentation or reports
  • Sharing formatted technical documents

Prerequisites

  • Node.js installed (v18+ recommended)
  • Google Chrome or Microsoft Edge browser installed

Quick Start

# Convert a markdown file to PDF
node convert.js input.md

# Specify output file
node convert.js input.md output.pdf

# Without page numbers
node convert.js input.md --no-page-numbers

Installation

First-time setup in the target project directory:

mkdir -p .md-to-pdf-tool && cd .md-to-pdf-tool
npm init -y
npm install [email protected] [email protected]

Then copy the convert.js script from this skill's directory.

Features

Feature Support
Headings (H1-H6) Styled with hierarchy
Code blocks Syntax highlighting via highlight.js
Tables Bordered with zebra striping
Lists Bulleted and numbered
Images Embedded (relative paths resolved)
Links Clickable in PDF
CJK/Chinese Full support
Page numbers Bottom center by default

Customization

Edit the CSS in convert.js to customize:

  • Font: Change font-family in body style
  • Colors: Modify color and background values
  • Margins: Adjust --marginTop, --marginBottom, etc. in options
  • Code theme: Change pre and code background colors

Common Issues

Issue Solution
Browser not found Set CHROME_PATH or EDGE_PATH environment variable
Permission denied Use Edge instead of Chrome, or run with elevated permissions
ESM module errors Use [email protected] and [email protected] (CommonJS compatible)
Large file timeout Increase timeout in page.setContent() options

Implementation

The conversion script uses:

  1. marked - Parse markdown to HTML
  2. puppeteer-core - Launch headless browser to render HTML
  3. Page.pdf() - Generate PDF from rendered page

See convert.js in this skill directory for the complete implementation.

安全使用建议
Reasonable to install for converting your own Markdown files. Avoid running it on untrusted Markdown unless you add request blocking or sanitization, because embedded remote resources could make network requests from your machine during PDF generation.
能力评估
Purpose & Capability
The files consistently describe and implement Markdown-to-PDF conversion using marked and puppeteer-core; file reading, browser launch, and PDF writing fit that purpose.
Instruction Scope
The runtime instructions are clear and conversion-focused, but they do not warn that embedded HTML or remote images/styles in Markdown may be loaded during rendering.
Install Mechanism
Installation is disclosed as local npm setup for marked and puppeteer-core plus copying the converter script; no hidden install hooks or privileged setup are shown.
Credentials
Launching a headless browser is proportionate for PDF rendering, but the script does not sanitize Markdown or block outbound browser requests.
Persistence & Privilege
No background workers, credential handling, privilege escalation, broad indexing, or durable persistence are present in the artifacts.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install zl-md-to-pdf
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /zl-md-to-pdf 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.0
init
元数据
Slug zl-md-to-pdf
版本 1.0.0
许可证 MIT-0
累计安装 0
当前安装数 0
历史版本数 1
常见问题

md-to-pdf 是什么?

Use when converting markdown files to PDF with styling, code highlighting, and CJK support. 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 51 次。

如何安装 md-to-pdf?

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

md-to-pdf 是免费的吗?

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

md-to-pdf 支持哪些平台?

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

谁开发了 md-to-pdf?

由 zhuleiKiro222(@zhuleikiro222)开发并维护,当前版本 v1.0.0。

💬 留言讨论