← Back to Skills Marketplace
zhuleikiro222

md-to-pdf

by zhuleiKiro222 · GitHub ↗ · v1.0.0 · MIT-0
cross-platform ✓ Security Clean
51
Downloads
1
Stars
0
Active Installs
1
Versions
Install in OpenClaw
/install zl-md-to-pdf
Description
Use when converting markdown files to PDF with styling, code highlighting, and CJK support
README (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.

Usage Guidance
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.
Capability Assessment
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.
How to Use
  1. Make sure OpenClaw is installed (local or Docker)
  2. Run the install command in chat: /install zl-md-to-pdf
  3. After installation, invoke the skill by name or use /zl-md-to-pdf
  4. Provide required inputs per the skill's parameter spec and get structured output
Version History
v1.0.0
init
Metadata
Slug zl-md-to-pdf
Version 1.0.0
License MIT-0
All-time Installs 0
Active Installs 0
Total Versions 1
Frequently Asked Questions

What is md-to-pdf?

Use when converting markdown files to PDF with styling, code highlighting, and CJK support. It is an AI Agent Skill for Claude Code / OpenClaw, with 51 downloads so far.

How do I install md-to-pdf?

Run "/install zl-md-to-pdf" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.

Is md-to-pdf free?

Yes, md-to-pdf is completely free, licensed under MIT-0. You can download, install and use it at no cost.

Which platforms does md-to-pdf support?

md-to-pdf is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).

Who created md-to-pdf?

It is built and maintained by zhuleiKiro222 (@zhuleikiro222); the current version is v1.0.0.

💬 Comments