md2pdf

Convert Markdown files to PDFs with built-in templates and Chinese support.

1|Updated Apr 4, 2026
One-click install
npx skills add https://github.com/WuYuStar/opencode-skills --skill md2pdf-wuyustar
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: md2pdf
Source: https://github.com/WuYuStar/opencode-skills/tree/main/md2pdf
Command: npx skills add https://github.com/WuYuStar/opencode-skills --skill md2pdf-wuyustar

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) components.

What problem does it solve?

This skill eliminates the tedious manual work of turning Markdown documents into well-formatted PDFs, enabling consistent, publication-ready output with support for multiple templates and Chinese typography.

Core Features & Use Cases

  • WeasyPrint-based rendering for high-quality PDFs without requiring a browser engine.
  • Built-in templates (default, modern, code-highlight, chinese-default, chinese-modern) and automatic template selection for Chinese text or code blocks.
  • A batch conversion script that can process multiple Markdown files in parallel, with optional output directory and per-file template selection.
  • Chinese font support and typography improvements for Chinese documents, including font fallbacks and indentation.
  • Use Case: convert a folder of docs into a PDF handbook with consistent styling.

Quick Start

Convert a Markdown document to a PDF using the built-in templates.

Frequently Asked Questions about md2pdf

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I convert Markdown to PDF with Chinese font support?

To convert Markdown to PDF with Chinese font support, this tool uses built-in templates like chinese-default and chinese-modern that handle font fallbacks and typography indentation automatically via WeasyPrint rendering.

What is the best way to batch convert Markdown files into a PDF handbook?

The best way to batch convert Markdown files is using the included batch_convert.py script, which processes multiple files in parallel and supports optional output directories with per-file template selection for consistent styling.

Does WeasyPrint render code blocks correctly when converting Markdown to PDF?

Yes, WeasyPrint renders code blocks correctly by utilizing the built-in code-highlight template, ensuring technical documents maintain proper syntax visibility and formatting in the final PDF output.

Can I use custom templates for Markdown to PDF conversion?

Yes, you can use custom templates for Markdown to PDF conversion alongside the built-in default, modern, and Chinese-specific options, ensuring publication-ready output tailored to your specific document styling needs.

Why use WeasyPrint instead of a browser engine for Markdown to PDF conversion?

Using WeasyPrint for Markdown to PDF conversion generates high-quality documents without requiring a browser engine, providing lightweight rendering and consistent publication-ready output across multiple built-in templates.

Do I need Python to run Markdown to PDF batch conversions?

Yes, you need Python to run Markdown to PDF batch conversions, as the tool relies on the md2pdf and WeasyPrint Python stack to execute the parallel processing script and render templates.