Token导航 LogoToken导航TokenDH.com
前端设计操作浏览器github未标认证来源可访问许可证需确认审计提醒

md2pdf2md2pdf2 命令行

Agent Skill

md2pdf2 用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要围绕仓库状态、代码变更或协作事项进行整理时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

428

周安装

18

GitHub Stars

公开资料未说明

下载量

150
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:md2pdf2(md2pdf2 命令行)
来源仓库:https://github.com/areai51/md2pdf2
仓库路径:skills/md2pdf2
安装命令:
npx skills add https://github.com/areai51/md2pdf2 --skill md2pdf2
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/areai51/md2pdf2 --skill md2pdf2

简介

用于处理 GitHub 仓库、Issue 和 Pull Request 协作信息。

  • 适合围绕代码变更或仓库状态进行整理分析。md2pdf2 属于前端设计类 Skill,可作为该场景下的辅助能力补充。
  • 通过 GitHub 安装,建议核验权限范围和命令执行风险。
  • 使用前应确认维护状态及是否会触发网络请求。
  • 可结合原始 README 了解具体操作流程。

SKILL.md

MD2PDF2 Skill

Convert Markdown to beautiful, professionally styled PDFs using the md2pdf2 CLI tool with Handlebars templates.

Overview

md2pdf2 is a Node.js CLI tool that converts Markdown → HTML (via HBS template) → PDF using Puppeteer. It supports:

  • Custom .hbs Handlebars templates with {{{content}}} for markdown body
  • CSS styling (inline or external)
  • PDF format options (A4, Letter, etc.)
  • Frontmatter metadata (title, author, date, etc.)
  • Built-in templates: default, modern, minimal, newsletter, resume

Workflow

Step 1 — Understand the request

Determine:

  1. Content: Does the user have markdown, or should you generate it from their description?
  2. Template/Style: Which built-in template fits, or should you create a custom .hbs?
  3. Output filename: Default to output.pdf unless specified.

Step 2 — Set up the environment

# Install md2pdf2 globally (or use npx)
npm install -g md2pdf2 2>/dev/null || true
# Verify
which md2pdf2 || npx md2pdf2 --version

If global install fails (permissions), use npx md2pdf2 in all commands.

Step 3 — Prepare files in /home/claude/

a) Write markdown content to /home/claude/input.md

Always include YAML frontmatter for metadata:

---
title: Document Title
author: Author Name
date: 2024-01-01
---

# Your Content Here

b) Create or select a template

For custom templates, write a .hbs file. See the Template Guide below.

For built-in templates, pass --template <name> (default, modern, minimal, newsletter, resume).

c) Write config if needed to /home/claude/md2pdf2.config.js:

export default {
  template: './custom.hbs',   // path to HBS template (optional)
  pdfOptions: {
    format: 'A4',             // 'A4' | 'Letter' | 'Legal'
    margin: { top: '2cm', right: '2cm', bottom: '2cm', left: '2cm' }
  }
}

Step 4 — Run the conversion

cd /home/claude && npx md2pdf2 convert input.md -o /mnt/user-data/outputs/output.pdf
# With custom template:
npx md2pdf2 convert input.md --template custom.hbs -o /mnt/user-data/outputs/output.pdf
# With built-in template name:
npx md2pdf2 convert input.md --template modern -o /mnt/user-data/outputs/output.pdf

Step 5 — Present the file

Use present_files with the output path.


Template Guide

Minimal valid HBS template

<!DOCTYPE html>
<html>
<head>
  <meta charset="UTF-8">
  <style>
    body { font-family: Georgia, serif; max-width: 800px; margin: 0 auto; padding: 40px; }
    h1 { color: #2c3e50; }
  </style>
</head>
<body>
  <h1>{{title}}</h1>
  <p>{{author}} — {{date}}</p>
  {{{content}}}
</body>
</html>

Key variables available in templates:

  • {{{content}}} — rendered HTML from markdown (use triple braces — no escaping)
  • {{title}} — from frontmatter
  • {{author}} — from frontmatter
  • {{date}} — from frontmatter
  • {{> partialName}} — include a partial from templates/parts/

Built-in Handlebars helpers:

  • {{currentDate}} — returns current date (e.g., "January 15, 2024")
  • {{slice str start end}} — slice a string (e.g., {{slice title 0 1}} for first character)
  • {{hasPartial "name"}} — check if a partial exists

Beautiful template recipes

See templates/ folder in this skill for ready-to-use templates:

  • professional-report.hbs — corporate report with cover page
  • resume.hbs — clean two-column CV layout
  • newsletter.hbs — styled newsletter with header/footer

Built-in Templates Quick Reference

TemplateBest For
defaultGeneral purpose, clean
modernBold, colorful, Inter font
minimalSimple serif, academic
newsletterEmail-style newsletter
resumeCV/resume formatting

Troubleshooting

md2pdf2: command not found → Use npx md2pdf2 instead.

Puppeteer/Chrome errors in sandbox → Add --no-sandbox flag if supported, or check if headless Chrome is available: google-chrome --version || chromium --version.

Template not found → Ensure the .hbs file path is relative to the working directory where you run the command.

Styles not applying → Check CSS is inside <style> tags in the HBS template, not external (external CSS won't load in Puppeteer's sandboxed env without explicit file:// paths).


Example: Full workflow

# 1. Write content
cat > /home/claude/input.md << 'EOF'
---
title: Q4 Sales Report
author: Finance Team
date: 2024-12-31
---

## Executive Summary
Revenue grew 23% YoY...

## Key Metrics
| Metric | Value |
|--------|-------|
| Revenue | $4.2M |
| Growth | 23% |
EOF

# 2. Convert with modern template
cd /home/claude && npx md2pdf2 convert input.md --template modern -o /mnt/user-data/outputs/q4-report.pdf

# 3. Verify
ls -la /mnt/user-data/outputs/q4-report.pdf

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

32.85%
按下载量换算49

Claude

27.9%
按下载量换算42

Cursor

20.32%
按下载量换算30

Gemini CLI

9.03%
按下载量换算14

安全审计

Gen Agent Trust Hub

可疑

Socket

通过

Snyk

可疑

权限和风险

操作浏览器

该 Skill 可能涉及浏览器控制能力,使用时可能读取或操作网页内容,需要在受控环境中确认权限边界。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在 warning/failed 结果,不能写成本站确认安全。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills