用 Markdown 做幻灯片/PPT:Marp 与 reveal.js 入门
每次改 PPT 都在和文本框较劲?换成纯文本写幻灯片,内容进版本库,一键生成可分享的演示。
用 Markdown 做簡報/PPT:Marp 與 reveal.js 入門
每次改 PPT 都在和文字框較勁?換成純文字寫簡報,內容進版本庫,一鍵生成可分享的演示。
Making Slides / PPT in Markdown: Getting Started with Marp & reveal.js
Tired of wrestling with text boxes every time you tweak a slide? Write slides in plain text—content goes into version control and generates a shareable deck in one click.
一、为什么用 Markdown 做幻灯片
传统 PPT 的痛点是:内容被锁进一个个文本框,改个字都要找位置。用 Markdown 写幻灯片,内容就是纯文本:
- 版本可控:能进 Git,每次改动有记录,团队改稿不再“最终版 8”。
- 专注内容:不用纠结配色对齐,主题交给工具,你只管讲什么。
- 一处写完,多处输出:同一份源可生成 PDF、HTML 甚至图片。
核心语法:用 --- 分隔每一页,其余就是普通 Markdown(标题、列表、代码块都照常)。
二、Marp:像写文档一样出 PPT
Marp 是最省心的路线。写一份 .md,用 --- 分页,配上主题就能导出 PDF/PPTX/HTML。
---
marp: true
theme: default
paginate: true
---
# 项目周报
## 本周进展
- 完成导出模块
- 修复 12 个缺陷
---
# 下周计划
1. 性能压测
2. 上线评审
适合:周会汇报、教学课件、产品介绍——要快速出漂亮幻灯片的人。
三、reveal.js:网页级交互演示
reveal.js 把幻灯片做成网页,支持缩放切换、代码逐行高亮、片段动画,演讲者视图也很强。
<section>
<h2>架构总览</h2>
<pre><code data-trim>function boot(){ /* ... */ }</code></pre>
</section>
<section>
<h2>关键路径</h2>
<p>请求 → 缓存 → 渲染</p>
</section>
适合:技术分享、代码演示、需要强交互或在线播放的场合。
四、两种路线怎么选
| 维度 | Marp | reveal.js |
|---|---|---|
| 上手难度 | 极低,纯 Markdown | 中等,需写少量 HTML |
| 视觉效果 | 主题漂亮、够用 | 可高度定制、交互强 |
| 输出形式 | PDF / PPTX / HTML | 网页为主 |
| 典型场景 | 汇报、课件 | 技术演讲、在线演示 |
五、导出与分享
- Marp:命令行或 VS Code 插件一键导出 PDF/PPTX。
- reveal.js:本身就是网页,部署即分享;也能打印成 PDF。
- 通用:先把 Markdown 导成 HTML(见 Markdown 导出 HTML),再托管到任意静态空间,就能发链接给别人在线看。
六、常见问题
Q:Markdown 做 PPT 和 PowerPoint 比有什么优势?
A:内容用纯文本写,能进 Git 做版本管理、用 diff 看改动;专注讲稿而非拖拽排版;同一份源文件可输出 PDF、HTML 或图片。
Q:Marp 和 reveal.js 该怎么选?
A:想要“像写文档一样出幻灯片”、又要漂亮主题和导出 PDF,选 Marp;想要缩放切换、代码演示、强交互的演讲,选 reveal.js。
Q:幻灯片里的代码块怎么高亮?
A:两者都支持围栏代码块并标注语言来高亮,例如 ```js。更多写法见我们的 Markdown 代码块与语法高亮 一文。
Q:做好后能放到网上分享吗?
A:可以。reveal.js 本就是网页;Marp 可导出 HTML。配合 Markdown 导出 HTML 的方法,就能得到可在线打开的演示页。
代码高亮细节看 Markdown 代码块与语法高亮;想把成果放到网上,参考 GitHub README 与项目文档 与 导出 HTML。
一、為什麼用 Markdown 做簡報
傳統 PPT 的痛點是:內容被鎖進一個個文字框,改個字都要找位置。用 Markdown 寫簡報,內容就是純文字:
- 版本可控:能進 Git,每次改動有記錄,團隊改稿不再「最終版 8」。
- 專注內容:不用糾結配色對齊,主題交給工具,你只管講什麼。
- 一處寫完,多處輸出:同一份源可生成 PDF、HTML 甚至圖片。
核心語法:用 --- 分隔每一頁,其餘就是普通 Markdown(標題、清單、程式碼塊都照常)。
二、Marp:像寫文件一樣出 PPT
Marp 是最省心的路線。寫一份 .md,用 --- 分頁,配上主題就能匯出 PDF/PPTX/HTML。
---
marp: true
theme: default
paginate: true
---
# 專案週報
## 本週進展
- 完成匯出模組
- 修復 12 個缺陷
---
# 下週計畫
1. 效能壓測
2. 上線評審
適合:週會報告、教學課件、產品介紹——要快速出漂亮簡報的人。
三、reveal.js:網頁級互動演示
reveal.js 把簡報做成網頁,支援縮放切換、程式碼逐行高亮、片段動畫,演講者視圖也很強。
<section>
<h2>架構總覽</h2>
<pre><code data-trim>function boot(){ /* ... */ }</code></pre>
</section>
<section>
<h2>關鍵路徑</h2>
<p>請求 → 快取 → 渲染</p>
</section>
適合:技術分享、程式碼演示、需要強互動或在線播放的場合。
四、兩種路線怎麼選
| 維度 | Marp | reveal.js |
|---|---|---|
| 上手難度 | 極低,純 Markdown | 中等,需寫少量 HTML |
| 視覺效果 | 主題漂亮、夠用 | 可高度定制、互動強 |
| 輸出形式 | PDF / PPTX / HTML | 網頁為主 |
| 典型場景 | 報告、課件 | 技術演講、在線演示 |
五、匯出與分享
- Marp:命令列或 VS Code 插件一鍵匯出 PDF/PPTX。
- reveal.js:本身就是網頁,部署即分享;也能列印成 PDF。
- 通用:先把 Markdown 匯成 HTML(見 Markdown 匯出 HTML),再託管到任意靜態空間,就能發連結給別人在線看。
六、常見問題
Q:Markdown 做 PPT 和 PowerPoint 比有什麼優勢?
A:內容用純文字寫,能進 Git 做版本管理、用 diff 看改動;專注講稿而非拖拽排版;同一份源檔可輸出 PDF、HTML 或圖片。
Q:Marp 和 reveal.js 該怎麼選?
A:想要「像寫文件一樣出簡報」、又要漂亮主題和匯出 PDF,選 Marp;想要縮放切換、程式碼演示、強互動的演講,選 reveal.js。
Q:簡報裡的程式碼塊怎麼高亮?
A:兩者都支援圍欄程式碼塊並標註語言來高亮,例如 ```js。更多寫法見我們的 Markdown 程式碼塊與語法高亮 一文。
Q:做好後能放到網上分享嗎?
A:可以。reveal.js 本就是網頁;Marp 可匯出 HTML。配合 Markdown 匯出 HTML 的方法,就能得到可線上打開的演示頁。
程式碼高亮細節看 Markdown 程式碼塊與語法高亮;想把成果放到網上,參考 GitHub README 與專案文件 與 匯出 HTML。
1. Why make slides in Markdown
The pain of traditional PPT is that content is locked into text boxes—you hunt for a spot just to change a word. Write slides in Markdown and the content is plain text:
- Version control: it goes into Git, every change is recorded, and the team stops producing "final version 8".
- Focus on content: no agonizing over colors and alignment—let the tool handle the theme; you just decide what to say.
- Write once, output anywhere: the same source generates PDF, HTML, even images.
Core syntax: use --- to separate each slide; everything else is ordinary Markdown (headings, lists, code blocks all work as usual).
2. Marp: slides like writing docs
Marp is the most carefree route. Write a .md file, split pages with ---, pick a theme, and export to PDF/PPTX/HTML.
---
marp: true
theme: default
paginate: true
---
# Weekly Report
## This Week
- Finished the export module
- Fixed 12 bugs
---
# Next Week
1. Performance testing
2. Launch review
Best for: weekly meetings, teaching slides, product intros—anyone who wants good-looking slides fast.
3. reveal.js: web-grade interactive decks
reveal.js turns slides into a web page, with zoom transitions, line-by-line code highlighting, fragment animations, and a strong speaker view.
<section>
<h2>Architecture Overview</h2>
<pre><code data-trim>function boot(){ /* ... */ }</code></pre>
</section>
<section>
<h2>Critical Path</h2>
<p>request → cache → render</p>
</section>
Best for: tech talks, code demos, and situations needing strong interaction or online playback.
4. How to choose between the two
| Dimension | Marp | reveal.js |
|---|---|---|
| Learning curve | Very low, pure Markdown | Medium, some HTML needed |
| Visuals | Pretty themes, enough | Highly customizable, strong interaction |
| Output | PDF / PPTX / HTML | Mainly web pages |
| Typical use | Reports, courseware | Tech talks, online demos |
5. Export & sharing
- Marp: one-click export to PDF/PPTX via the command line or the VS Code plugin.
- reveal.js: it's a web page already—deploy and share; it can also print to PDF.
- Universal: first export Markdown to HTML (see Markdown to HTML), then host it on any static space and send the link for others to view online.
6. FAQ
Q: What are the advantages of Markdown slides vs. PowerPoint?
A: Content is written as plain text, so it goes into Git for version control and diffs show changes; you focus on the script instead of dragging boxes; the same source outputs PDF, HTML, or images.
Q: How do I choose between Marp and reveal.js?
A: Pick Marp if you want "slides like writing a doc" with pretty themes and PDF export; pick reveal.js for zoom transitions, code demos, and highly interactive talks.
Q: How do I highlight code blocks in slides?
A: Both support fenced code blocks tagged with a language for highlighting, e.g. ```js. For more, see our Markdown code blocks & syntax highlighting article.
Q: Can I put the finished deck online to share?
A: Yes. reveal.js is already a web page; Marp can export HTML. Combined with the Markdown to HTML approach, you get a demo page that opens online.
For code-highlighting details, see Markdown code blocks & syntax highlighting; to put your work online, refer to GitHub READMEs & project docs and Export to HTML.