Files
llm_wiki/wiki/Marp 导出.md

99 lines
2.0 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
categories:
- "[[Marp]]"
tags:
- marp
- export
- cli
created: 2026-04-07
source: "[[marp-guide]]"
type: reference
aliases:
- Marp 导出
- Marp CLI
---
# Marp 导出
> Marp 支持将 Markdown 幻灯片导出为 HTML、PDF、PPTX 和图片。
## 导出方式对比
| 方式 | 平台 | 需要安装 | 适合场景 |
|------|------|----------|----------|
| **Obsidian Marp 插件** | Obsidian | Node.js | 快速导出到 Downloads |
| **Marp CLI** | 终端 | Node.js / brew / scoop | 自动化、批处理 |
| **VS Code 扩展** | VS Code | 扩展商店 | 编辑+导出一体 |
## Marp CLI 安装
```bash
# npm推荐无需全局安装
npx @marp-team/marp-cli@latest
# macOS
brew install marp-cli
# Windows (Scoop)
scoop install marp
```
## 常用命令
```bash
# 导出 HTML默认
marp presentation.md
# 导出 PDF
marp presentation.md --pdf
# 导出 PPTX
marp presentation.md --pptx
# 导出图片(每页一张 PNG
marp presentation.md --images
# 指定输出文件
marp presentation.md -o slides.html
# 使用特定主题
marp --theme uncover --pdf presentation.md
# 导出后立即打开
marp presentation.md --pdf --open
# 允许加载本地图片
marp presentation.md --pdf --allow-local-files
```
> [!warning] PDF 和 PPTX 导出需要系统安装 **Chrome 或 Edge**(使用 Chromium 渲染引擎)。
## HTML 导出特点
- 完整样式和主题支持
- 交互式导航(方向键、空格键)
- 自定义过渡效果和动画
- 响应式设计,适应不同屏幕
- 适合通过链接分享
## PDF 导出特点
- 跨设备通用
- 适合打印
- 排版一致
- 离线可用
## Obsidian Marp 插件导出
1. 打开 Marp 预览(侧边栏按钮或命令面板 `Marp: Open Preview`
2. 在预览窗口点击导出按钮
3. 选择格式PDF / PPTX / HTML
4. 文件自动保存到 `Downloads` 目录
> [!note] 导出的文件中图片自动转为 Base64 嵌入,方便分享。
## 来源
- [[marp-guide]] — 原始资料
- [[Marp]] — Marp 概念页