用Markdown制作PPT

使用 Marp for VS CodeMarkdown 转换为 PPT

Markdown 是一种轻量级标记语言,广泛用于撰写文档和笔记。

VSCode 是一个功能丰富的代码编辑器,它支持许多插件,包括 Marp,可以将 Markdown 文档转换为演示文稿。

安装和设置

  1. 打开 VSCode
  2. 安装 Marp for VS Code 扩展

创建 Marp 演示文稿

  1. 新建一个 Markdown 文件
  2. 启用 Marp:在文件的顶部添加 YAMLFront Matter``:
1
2
3
---
marp: true
---
  1. 撰写幻灯片:每页幻灯片由一个 --- 分隔,在单页顶部使用<!-- -->修改局部配置,语法支持markdown

常用Front Matter

1
2
3
4
5
6
7
8
9
10
11
12
13
14
---
marp: true
<!-- 设置主题 -->
theme:
<!-- 显示页码 -->
paginate: true
<!-- 全局background -->
backgroundColor:
backgroundImage:
<!-- 页眉 -->
header:
<!-- 页脚 -->
footer:
---

for example:

partOfcodeFrom
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
---
marp: true
theme: gaia
_class: lead
paginate: true
backgroundImage: url('https://marp.app/assets/hero-background.svg')
---

![bg left:40% 80%](https://marp.app/assets/marp.svg)

# **Marp**

`Markdown` Presentation Ecosystem

https://marp.app/

---
<!-- _header: header -->

# title

```java
class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello, world.");
}
}
1
2
3
4
5
6
7
8
9
10
11

![Alt text](https://s2.loli.net/2024/01/31/qnQA7gk2vw59JbF.png)

## 配置`directives`

局部设置有`local`和`spot`两种。

常用的是`spot`,用来设置单页的页眉。用法如下:

```markdown 格式
<!-- _header: 小标题 -->

配置themes

配置项:

1
2
3
4
"markdown.marp.themes": [
"yourlocalpathOrurl/yourthemes.css",
"another"
]

导出

  1. 预览演示文稿:点击右上角的预览图标

  2. 导出为 PPT:点击右上角 Marp 图标,然后选择 export slide deck 导出为pptx。

end

推荐一个好看的主题Awesome-Marp

更多marp信息查看Marpit documentation