md-to-pdf

Convert Markdown files to PDFs with syntax highlighting and CSS support.

Updated Feb 17, 2026
One-click install
npx skills add https://github.com/alexzuosh/alex_skills --skill md-to-pdf-alexzuosh
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: md-to-pdf
Source: https://github.com/alexzuosh/alex_skills/tree/main/md-to-pdf
Command: npx skills add https://github.com/alexzuosh/alex_skills --skill md-to-pdf-alexzuosh

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires markdown, weasyprint, Pygments, and includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill automates the conversion of Markdown files into well-formatted PDF documents, including the rendering of diagrams directly within the output.

Core Features & Use Cases

  • Batch Conversion: Convert multiple Markdown files in a directory to PDF.
  • Diagram Rendering: Supports Mermaid, PlantUML, GraphViz, and more via Kroki.io.
  • Styling: Applies a clean, GitHub-like CSS for readability.
  • Use Case: Generate a printable project documentation set from your Markdown files, ensuring all diagrams are correctly embedded.

Quick Start

Use the md-to-pdf skill to convert files in /path/to/docs

Frequently Asked Questions about md-to-pdf

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

FAQPage Schema
How do I convert Markdown to PDF with embedded diagrams?

You can convert Markdown to PDF with embedded diagrams by rendering code blocks through Kroki.io and applying a GitHub-like stylesheet via WeasyPrint. This process supports Mermaid, PlantUML, and GraphViz formats directly within the output document.

Can I batch convert multiple Markdown files to PDF automatically?

Yes, you can batch convert multiple Markdown files to PDF automatically. This skill processes all .md files within a specified directory, applying consistent CSS styling and syntax highlighting to generate a complete set of formatted PDF documents.

Does WeasyPrint support syntax highlighting for code blocks in PDF conversion?

Yes, WeasyPrint supports syntax highlighting for code blocks during PDF conversion. The process utilizes Pygments to apply formatting, ensuring code snippets are readable and styled correctly alongside the GitHub-like CSS in the final PDF output.

What is the best way to render Mermaid diagrams when converting Markdown to PDF?

The best way to render Mermaid diagrams when converting Markdown to PDF is using Kroki.io. The conversion pipeline intercepts diagram code blocks, sends them to Kroki.io for rendering, and embeds the resulting images directly into the formatted PDF.

Do I need Python dependencies installed to convert Markdown to PDF with diagrams?

Yes, you need Python dependencies installed to convert Markdown to PDF with diagrams. The conversion requires the markdown, weasyprint, and Pygments libraries to process text, apply CSS styling, and render syntax highlighting correctly.

Why does my Markdown to PDF conversion fail with missing CSS or diagram errors?

Markdown to PDF conversion fails with missing CSS or diagram errors when WeasyPrint cannot apply stylesheets or Kroki.io is unreachable. Ensure all Python dependencies like weasyprint and Pygments are installed and network access is available for diagram rendering.