360 Secure SkillHub
360 安全技能中心

Markdown to PDF

该 Skill 通过 python3 脚本先把 Markdown 转为 HTML,再调用 wkhtmltopdf 生成 PDF。支持自定义 CSS、代码语法高亮和内嵌样式,适用于文档、笔记和报告的导出分享。需预先安装 markdown、pygments 与 wkhtmltopdf。

alone86136
alone86136
热度 62.09
最近更新 2026-05-11 17:35:43
分类:效率依赖:代码执行 / 读写文件应用场景:文件转换

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add markdown-to-pdf
Metadata
name
markdown-to-pdf
description
Convert Markdown files to beautiful PDF documents. Supports custom styling, code highlighting, and multiple output options. Use when users need to convert MD to PDF for documentation, notes, reports, or sharing.

markdown-to-pdf

Overview

Convert Markdown text or files to professional-looking PDF documents. Uses markdown package to convert MD to HTML, then wkhtmltopdf to generate PDF. Supports code syntax highlighting and custom CSS styling.

Features

  • Convert MD file to PDF: Take a Markdown file and output a ready-to-share PDF
  • Standalone output: Embeds all styles, no external dependencies
  • Code highlighting: Automatic syntax highlighting for code blocks
  • Custom CSS: Option to provide custom CSS for styling

Dependencies

pip install markdown pygments
# You also need wkhtmltopdf installed:
# macOS: brew install wkhtmltopdf
# Ubuntu/Debian: sudo apt install wkhtmltopdf

Usage

Basic conversion

python3 scripts/convert.py input.md output.pdf

With custom CSS

python3 scripts/convert.py --css custom.css input.md output.pdf

Resources

scripts/

  • convert.py - Convert Markdown file to PDF