跳到主要内容
知仓学习社ZHICANG

marp-export

Export Marp slide markdown files to PDF (default), HTML, PPTX, or PNG. Handles theme loading, Chrome/Chromium detection for PDF export, and batch co…

不碰外部(只输出文字)无严重或高危命中brycewang-stanford/Auto-Empirical-Research-Skills

它会碰到什么

扫了多少1 个文本文件,5 KB
它会碰到什么不碰外部(只输出文字)
命中总数0 处
命中统计严重 0 · 高 0 · 中 0 · 低 0

这一栏是扫描器报的事实,不是结论。命中多不等于有毒(安全工具、规则库、示例脚本本来就会包含危险写法),命中少也不等于干净。它和你手上的凭据、文件、网络有什么关系,需要你自己看。

技能内容

Marp Export Skill

Export existing Marp markdown files to PDF (default), HTML, PPTX, or PNG.

Quick Reference

# PDF (default) — requires Chrome/Chromium
npx @marp-team/marp-cli INPUT.md -o OUTPUT.pdf --theme-set ~/.claude/skills/marp-slides-creator/themes/ --allow-local-files --html

# HTML
npx @marp-team/marp-cli INPUT.md -o OUTPUT.html --theme-set ~/.claude/skills/marp-slides-creator/themes/ --html

# PPTX (editable, requires LibreOffice)
npx @marp-team/marp-cli INPUT.md -o OUTPUT.pptx --pptx-editable --theme-set ~/.claude/skills/marp-slides-creator/themes/ --allow-local-files

# PNG sequence
npx @marp-team/marp-cli INPUT.md --images png -o OUTPUT_DIR/ --theme-set ~/.claude/skills/marp-slides-creator/themes/

Workflow

Step 1: Locate Input File

Find the Marp markdown file. It must contain marp: true in YAML frontmatter.

# Verify it's a Marp file
head -5 INPUT.md  # should show "marp: true"

Step 2: Theme Directory

Themes are stored in the marp-slides-creator skill:

THEME_DIR="$HOME/.claude/skills/marp-slides-creator/themes/"

Always use --theme-set "$THEME_DIR/" in all export commands.

Step 3: Detect Chrome/Chromium (for PDF/PPTX)

PDF and PPTX export require a Chrome/Chromium browser. Marp-cli auto-detects, but if it fails:

# macOS Chrome paths (check in order)
/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --version
/Applications/Chromium.app/Contents/MacOS/Chromium --version
/Applications/Microsoft\ Edge.app/Contents/MacOS/Microsoft\ Edge --version

# Set CHROME_PATH if auto-detection fails
export CHROME_PATH="/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"

If no browser found, fall back to HTML export and inform the user.

Step 4: Export

Default format is PDF. User can specify otherwise.

Output naming convention:

  • Same directory as input file
  • Same base name, different extension
  • Example: presentation.mdpresentation.pdf

PDF export:

npx @marp-team/marp-cli INPUT.md \
  -o OUTPUT.pdf \
  --theme-set ~/.claude/skills/marp-slides-creator/themes/ \
  --allow-local-files \
  --html

HTML export:

npx @marp-team/marp-cli INPUT.md \
  -o OUTPUT.html \
  --theme-set ~/.claude/skills/marp-slides-creator/themes/ \
  --html

Both PDF + HTML:

# Run sequentially
npx @marp-team/marp-cli INPUT.md -o OUTPUT.pdf --theme-set ~/.claude/skills/marp-slides-creator/themes/ --allow-local-files --html
npx @marp-team/marp-cli INPUT.md -o OUTPUT.html --theme-set ~/.claude/skills/marp-slides-creator/themes/ --html

Step 5: Verify & Report

# Check output exists and show file size
ls -lh OUTPUT.pdf OUTPUT.html 2>/dev/null

Report to user:

  • Output file path(s)
  • File size(s)
  • Format(s) generated
  • Any warnings from marp-cli

Key Flags Reference

| Flag | Purpose | When to use |

|------|---------|-------------|

| --theme-set DIR/ | Load custom themes | When custom .css themes exist |

| --allow-local-files | Allow local images | PDF/PPTX with local assets |

| --html | Enable HTML tags in markdown | Always recommended |

| --pptx-editable | Editable PPTX output | PPTX format (needs LibreOffice) |

| --images png | Export as PNG sequence | PNG format |

| --pdf-notes | Include speaker notes in PDF | When notes are present |

| --pdf-outlines | Add bookmarks to PDF | For long presentations |

Error Handling

| Error | Cause | Fix |

|-------|-------|-----|

| Chrome/Chromium not found | No browser for PDF | Set CHROME_PATH or fall back to HTML |

| theme not found | Missing theme CSS | Check --theme-set path, use built-in theme |

| Could not find an input | Bad file path | Verify path and marp: true frontmatter |

| Blank/empty PDF | HTML tags without --html | Add --html flag |

Examples

# Export current project's slides to PDF
npx @marp-team/marp-cli slides_project/05_final/presentation.md \
  -o slides_project/05_final/slides.pdf \
  --theme-set ~/.claude/skills/marp-slides-creator/themes/ \
  --allow-local-files --html

# Quick HTML export (no Chrome needed)
npx @marp-team/marp-cli my-talk.md -o my-talk.html --html

# Batch export all .md files in a directory
for f in slides/*.md; do
  npx @marp-team/marp-cli "$f" -o "${f%.md}.pdf" --allow-local-files --html
done

想直接用这个技能?

本站把开放许可(MIT / Apache 等)的技能按仓库打包整理到网盘,点一下转存到你自己的网盘,不用一个个从 GitHub 拉。许可未声明的技能只给原始仓库链接,不打包。