---
name: php186-skill-18930
description: "使用 Pandoc 和 Typst 将 Markdown 文件转换为美观的 PDF，支持标题、表格、代码块、链接、表情符号和 GitHub 风格的格式化。"
---

# md2pdf (Pandoc + Typst)

## md2pdf

 

Converts Markdown to PDF with professional formatting.

 

## Requirements

 

- **Pandoc** (v3.2+): ` brew install pandoc `
- **Typst** (v0.12+): ` brew install typst `

 

## Usage

 

```
bash ~/.openclaw/workspace/skills/md2pdf/scripts/md2pdf.sh "/path/to/file.md"
```

 

The PDF is saved in the same directory as the source MD file.

 

## Features

 

- GitHub-style headings with horizontal rules
- Tables, bullet lists, numbered lists
- Code blocks with syntax highlighting (monospace, grey background)
- Inline code formatting
- Clickable links (blue, underlined)
- Emoji support
- German language optimized (hyphenation)
- Clean typography (Helvetica Neue / Arial)

 

## Examples

 

```
# Single file
bash ~/.openclaw/workspace/skills/md2pdf/scripts/md2pdf.sh report.md
# → creates report.pdf in same folder

# From any agent workspace
bash ~/.openclaw/workspace/skills/md2pdf/scripts/md2pdf.sh /full/path/to/notes.md
```

 

## TOOLS.md Entry

 

Add this to your agent's TOOLS.md:

 

```
## PDF erstellen (md2pdf)
- Markdown zu PDF: `bash ~/.openclaw/workspace/skills/md2pdf/scripts/md2pdf.sh "/pfad/zur/datei.md"`
- Das PDF wird im gleichen Ordner wie das MD abgelegt.
```
