presenterm

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

presenterm - Terminal Slideshow Tool

presenterm - 终端幻灯片工具

presenterm is a modern terminal-based presentation tool that renders markdown files as slides. It supports themes, code syntax highlighting, images, diagram rendering (mermaid, d2), mathematical formulas (LaTeX, typst), and can export to PDF or HTML.
presenterm是一款现代终端演示工具,可将Markdown文件渲染为幻灯片。它支持主题切换、代码语法高亮、图片展示、图表渲染(mermaid、d2)、数学公式(LaTeX、typst),并可导出为PDF或HTML格式。

Core Principles

核心特性

  • Markdown-first: Write presentations in familiar markdown syntax
  • Terminal-native: Runs entirely in the terminal with rich rendering
  • Advanced rendering: Render mermaid/d2 diagrams and LaTeX/typst formulas as images
  • Presentation mode: Separate presentation view with speaker notes support
  • Export capabilities: Generate PDF or HTML from markdown slides
  • Code execution: Execute code snippets during presentations
  • Theme support: Multiple built-in themes and custom theme support
  • Markdown优先:使用熟悉的Markdown语法编写演示文稿
  • 原生终端支持:完全在终端中运行,提供丰富的渲染效果
  • 高级渲染:将mermaid/d2图表和LaTeX/typst公式渲染为图片
  • 演示模式:独立的演示视图,支持演讲者备注
  • 导出功能:将Markdown幻灯片生成PDF或HTML
  • 代码执行:演示过程中执行代码片段
  • 主题支持:多种内置主题及自定义主题支持

Installation

安装

bash
undefined
bash
undefined

macOS (Homebrew)

macOS(Homebrew)

brew install presenterm
brew install presenterm

Cargo

Cargo

cargo install presenterm
cargo install presenterm

From source

从源码安装

git clone https://github.com/mfontanini/presenterm cd presenterm cargo install --path .
undefined
git clone https://github.com/mfontanini/presenterm cd presenterm cargo install --path .
undefined

Basic Usage

基础用法

Running Presentations

运行演示文稿

bash
undefined
bash
undefined

Run a presentation

运行演示文稿

presenterm presentation.md
presenterm presentation.md

Use presentation mode (full-screen, controls hidden)

使用演示模式(全屏,隐藏控制栏)

presenterm -p presentation.md presenterm --present presentation.md
presenterm -p presentation.md presenterm --present presentation.md

Use specific theme

使用指定主题

presenterm -t dark presentation.md presenterm --theme catppuccin presentation.md
presenterm -t dark presentation.md presenterm --theme catppuccin presentation.md

List available themes

列出可用主题

presenterm --list-themes
presenterm --list-themes

Show current theme

查看当前主题

presenterm --current-theme
undefined
presenterm --current-theme
undefined

Exporting

导出

bash
undefined
bash
undefined

Export to PDF

导出为PDF

presenterm -e presentation.md presenterm --export-pdf presentation.md
presenterm -e presentation.md presenterm --export-pdf presentation.md

Export to PDF with specific output path

导出为PDF并指定输出路径

presenterm -e presentation.md -o output.pdf presenterm --export-pdf presentation.md --output slides.pdf
presenterm -e presentation.md -o output.pdf presenterm --export-pdf presentation.md --output slides.pdf

Export to HTML

导出为HTML

presenterm -E presentation.md presenterm --export-html presentation.md -o presentation.html
presenterm -E presentation.md presenterm --export-html presentation.md -o presentation.html

Specify temporary path for export

指定导出临时路径

presenterm -e presentation.md --export-temporary-path /tmp/presenterm
undefined
presenterm -e presentation.md --export-temporary-path /tmp/presenterm
undefined

Markdown Syntax

Markdown语法

Slide Separators

幻灯片分隔符

markdown
<!-- Slides are separated by --- -->
markdown
<!-- 幻灯片使用 --- 分隔 -->

First Slide

第一张幻灯片

Content here

内容在这里

Second Slide

第二张幻灯片

More content

更多内容

Third Slide

第三张幻灯片

Final slide
undefined
最后一张幻灯片
undefined

Slide Layout

幻灯片布局

markdown
undefined
markdown
undefined

Title Slide

标题幻灯片

Subtitle

副标题

Author Name

作者姓名

Content Slide

内容幻灯片

  • Bullet point 1
  • Bullet point 2
    • Nested point
  • Bullet point 3

  • 项目符号1
  • 项目符号2
    • 嵌套项目
  • 项目符号3

Code Slide

代码幻灯片

rust
fn main() {
    println!("Hello, presenterm!");
}
``` (triple backtick)

---
rust
fn main() {
    println!("Hello, presenterm!");
}
```(三个反引号)

---

Quote Slide

引用幻灯片

"The best way to predict the future is to invent it." — Alan Kay
undefined
"预测未来的最好方式就是创造它。" — 艾伦·凯
undefined

Speaker Notes

演讲者备注

markdown
undefined
markdown
undefined

My Slide

我的幻灯片

Visible content
<!-- presenter notes These notes are only visible in presentation mode They won't appear on the slide itself -->
More visible content

可见内容
<!-- presenter notes 这些备注仅在演示模式下可见 不会显示在幻灯片本身 -->
更多可见内容

Another Slide

另一张幻灯片

<!-- speaker notes - Remember to mention X - Don't forget Y - Emphasize Z -->
undefined
<!-- speaker notes - 记得提及X - 不要忘记Y - 强调Z -->
undefined

Images

图片

markdown
undefined
markdown
undefined

Image Slide

图片幻灯片

Description

描述

Centered Image

居中图片

undefined
undefined

Tables

表格

markdown
undefined
markdown
undefined

Table Example

表格示例

FeatureStatusPriority
ExportDoneHigh
ThemesDoneHigh
ImagesDoneMedium
undefined
功能状态优先级
导出已完成
主题已完成
图片已完成
undefined

Code Highlighting

代码高亮

markdown
undefined
markdown
undefined

Syntax Highlighting

语法高亮

python
def fibonacci(n):
    if n <= 1:
        return n
    return fibonacci(n-1) + fibonacci(n-2)
rust
fn factorial(n: u64) -> u64 {
    (1..=n).product()
}
javascript
const greet = (name) => {
    console.log(`Hello, ${name}!`);
};
undefined
python
def fibonacci(n):
    if n <= 1:
        return n
    return fibonacci(n-1) + fibonacci(n-2)
rust
fn factorial(n: u64) -> u64 {
    (1..=n).product()
}
javascript
const greet = (name) => {
    console.log(`Hello, ${name}!`);
};
undefined

Code Execution

代码执行

Executable Code Blocks

可执行代码块

bash
undefined
bash
undefined

Enable code snippet execution

启用代码片段执行

presenterm -x presentation.md presenterm --enable-snippet-execution presentation.md
presenterm -x presentation.md presenterm --enable-snippet-execution presentation.md

Enable auto-execution with replacement

启用自动执行并替换结果

presenterm -X presentation.md presenterm --enable-snippet-execution-replace presentation.md
presenterm -X presentation.md presenterm --enable-snippet-execution-replace presentation.md

Validate snippets without running

验证代码片段但不运行

presenterm --validate-snippets presentation.md
undefined
presenterm --validate-snippets presentation.md
undefined

Executable Code Syntax

可执行代码语法

markdown
undefined
markdown
undefined

Live Demo

实时演示

bash
echo "This will execute when you advance to this slide"
date

bash
echo "切换到该幻灯片时会执行此命令"
date

Auto-Replace Demo

自动替换演示

bash
ls -la
<!-- The output will replace the code block -->
undefined
bash
ls -la
<!-- 执行结果会替换代码块 -->
undefined

Advanced Rendering

高级渲染

presenterm supports rendering diagrams and formulas directly from code blocks, converting them to images during presentation load.
presenterm支持直接从代码块渲染图表和公式,在演示加载时将其转换为图片。

Mermaid Diagrams

Mermaid图表

Render mermaid diagrams using the
+render
attribute.
Requirements:
  • Install mermaid-cli:
    npm install -g @mermaid-js/mermaid-cli
Syntax:
markdown
```mermaid +render
sequenceDiagram
    Alice->>Bob: Hello Bob, how are you?
    Bob-->>Alice: I'm good thanks!
    Alice-)Bob: See you later!
```

```mermaid +render
graph TD
    A[Start] --> B{Is it working?}
    B -->|Yes| C[Great!]
    B -->|No| D[Debug]
    D --> B
```

```mermaid +render
pie title Project Time Distribution
    "Development" : 40
    "Testing" : 25
    "Documentation" : 20
    "Meetings" : 15
```
Configuration (in config.yaml):
yaml
mermaid:
  # Theme selection
  theme: dark
  # Background color
  background: "#2E3440"
  # Image scaling
  scale: 2.0
Size control with width attribute:
markdown
```mermaid +render +width:80%
graph LR
    A --> B --> C
```
Performance Note:
  • Rendering takes ~2 seconds per diagram
  • Rendered asynchronously (default 2 threads)
使用
+render
属性渲染Mermaid图表。
要求:
  • 安装mermaid-cli
    npm install -g @mermaid-js/mermaid-cli
语法:
markdown
```mermaid +render
sequenceDiagram
    Alice->>Bob: Hello Bob, how are you?
    Bob-->>Alice: I'm good thanks!
    Alice-)Bob: See you later!
```

```mermaid +render
graph TD
    A[开始] --> B{是否正常工作?}
    B -->|是| C[太好了!]
    B -->|否| D[调试]
    D --> B
```

```mermaid +render
pie title 项目时间分配
    "开发" : 40
    "测试" : 25
    "文档" : 20
    "会议" : 15
```
配置(在config.yaml中):
yaml
mermaid:
  # 主题选择
  theme: dark
  # 背景颜色
  background: "#2E3440"
  # 图片缩放
  scale: 2.0
使用width属性控制尺寸:
markdown
```mermaid +render +width:80%
graph LR
    A --> B --> C
```
性能说明:
  • 每个图表渲染约需2秒
  • 异步渲染(默认2线程)

d2 Diagrams

D2图表

Render d2 diagrams for architecture and system diagrams.
Requirements:
  • Install d2:
    brew install d2
    or download from releases
Syntax:
markdown
```d2 +render
渲染D2图表用于架构和系统图展示。
要求:
  • 安装d2
    brew install d2
    或从发布页下载
语法:
markdown
```d2 +render

System Architecture

系统架构

web_server: Web Server { shape: rectangle } database: Database { shape: cylinder } cache: Redis Cache { shape: stored_data }
web_server -> database: queries web_server -> cache: reads/writes

```d2 +render
my_table: {
  shape: sql_table
  id: int {constraint: primary_key}
  username: varchar(255)
  email: varchar(255)
  created_at: timestamp
}
d2
direction: right

users -> api: HTTP requests
api -> auth: validate token
api -> database: query data
api -> cache: check cache

**Configuration (in config.yaml):**

```yaml
d2:
  # Theme selection
  theme: "Nord"
  # Image scaling
  scale: 1.5
```

**Size control:**

````markdown
```d2 +render +width:70%
A -> B -> C
```
web_server: Web服务器 { shape: rectangle } database: 数据库 { shape: cylinder } cache: Redis缓存 { shape: stored_data }
web_server -> database: 查询 web_server -> cache: 读/写

```d2 +render
my_table: {
  shape: sql_table
  id: int {constraint: primary_key}
  username: varchar(255)
  email: varchar(255)
  created_at: timestamp
}
d2
direction: right

users -> api: HTTP请求
api -> auth: 验证令牌
api -> database: 查询数据
api -> cache: 检查缓存

**配置(在config.yaml中):**

```yaml
d2:
  # 主题选择
  theme: "Nord"
  # 图片缩放
  scale: 1.5
```

**尺寸控制:**

````markdown
```d2 +render +width:70%
A -> B -> C
```

LaTeX Formulas

LaTeX公式

Render LaTeX mathematical formulas as images.
Requirements:
  • Install typst:
    brew install typst
    or
    cargo install typst-cli
  • Install pandoc:
    brew install pandoc
How it works:
  • Pandoc converts LaTeX to typst
  • Typst renders the formula to an image
Syntax:
markdown
```latex +render
\[ \sum_{n=1}^{\infty} 2^{-n} = 1 \]
```

```latex +render
\[
E = mc^2
\]
```

```latex +render
\[
\int_{-\infty}^{\infty} e^{-x^2} dx = \sqrt{\pi}
\]
```

```latex +render
\[
\frac{d}{dx}\left( \int_{a}^{x} f(u)\,du\right) = f(x)
\]
```

```latex +render
\[
\begin{bmatrix}
a & b \\
c & d
\end{bmatrix}
\]
```
Configuration (in config.yaml):
yaml
undefined
将LaTeX数学公式渲染为图片。
要求:
  • 安装typst
    brew install typst
    cargo install typst-cli
  • 安装pandoc
    brew install pandoc
工作原理:
  • Pandoc将LaTeX转换为Typst
  • Typst将公式渲染为图片
语法:
markdown
```latex +render
\\[ \\sum_{n=1}^{\\infty} 2^{-n} = 1 \\]
```

```latex +render
\\[
E = mc^2
\\]
```

```latex +render
\\[
\\int_{-\\infty}^{\\infty} e^{-x^2} dx = \\sqrt{\\pi}
\\]
```

```latex +render
\\[
\\frac{d}{dx}\\left( \\int_{a}^{x} f(u)\\,du\\right) = f(x)
\\]
```

```latex +render
\\[
\\begin{bmatrix}
a & b \\\\
c & d
\\end{bmatrix}
\\]
```
配置(在config.yaml中):
yaml
undefined

Pixels per inch for formula rendering

公式渲染的像素密度

typst: ppi: 300

**Size control:**

````markdown
```latex +render +width:60%
\[ \oint_C \mathbf{F} \cdot d\mathbf{r} = \iint_S (\nabla \times \mathbf{F}) \cdot d\mathbf{S} \]
undefined
typst: ppi: 300

**尺寸控制:**

````markdown
```latex +render +width:60%
\\[ \\oint_C \\mathbf{F} \\cdot d\\mathbf{r} = \\iint_S (\
abla \\times \\mathbf{F}) \\cdot d\\mathbf{S} \\]
undefined

Typst Formulas

Typst公式

Render typst formulas directly (bypassing LaTeX conversion).
Requirements:
  • Install typst:
    brew install typst
Syntax:
markdown
```typst +render
$ sum_(n=1)^oo 1/n^2 = pi^2/6 $
```

```typst +render
$ integral_(-oo)^oo e^(-x^2) d x = sqrt(pi) $
```

```typst +render
$ mat(
  1, 2;
  3, 4;
) $
```
Benefits over LaTeX:
  • Faster (no pandoc conversion step)
  • Native typst syntax
  • More modern formula typesetting
直接渲染Typst公式(跳过LaTeX转换步骤)。
要求:
  • 安装typst
    brew install typst
语法:
markdown
```typst +render
$ sum_(n=1)^oo 1/n^2 = pi^2/6 $
```

```typst +render
$ integral_(-oo)^oo e^(-x^2) d x = sqrt(pi) $
```

```typst +render
$ mat(
  1, 2;
  3, 4;
) $
```
相比LaTeX的优势:
  • 速度更快(无需Pandoc转换步骤)
  • 原生Typst语法
  • 更现代的公式排版

Rendering Configuration

渲染配置

Global config.yaml settings:
yaml
undefined
全局config.yaml设置:
yaml
undefined

Formula rendering

公式渲染

typst: ppi: 300 # Pixels per inch for formulas
typst: ppi: 300 # 公式的像素密度

Mermaid diagrams

Mermaid图表

mermaid: theme: dark background: "#2E3440" scale: 2.0
mermaid: theme: dark background: "#2E3440" scale: 2.0

d2 diagrams

D2图表

d2: theme: "Nord" scale: 1.5
undefined
d2: theme: "Nord" scale: 1.5
undefined

Complete Rendering Example

完整渲染示例

markdown
undefined
markdown
undefined

System Architecture

系统架构

d2
users: Users {
  shape: person
}
lb: Load Balancer {
  shape: rectangle
}
api: API Servers {
  shape: rectangle
}
db: Database {
  shape: cylinder
}

users -> lb
lb -> api: distribute
api -> db: query

d2
users: 用户 {
  shape: person
}
lb: 负载均衡器 {
  shape: rectangle
}
api: API服务器 {
  shape: rectangle
}
db: 数据库 {
  shape: cylinder
}

users -> lb
lb -> api: 分发
api -> db: 查询

Request Flow

请求流程

mermaid
sequenceDiagram
    participant U as User
    participant A as API
    participant D as Database
    participant C as Cache

    U->>A: Request data
    A->>C: Check cache
    alt Cache hit
        C-->>A: Return cached data
    else Cache miss
        A->>D: Query database
        D-->>A: Return data
        A->>C: Update cache
    end
    A-->>U: Response

mermaid
sequenceDiagram
    participant U as 用户
    participant A as API
    participant D as 数据库
    participant C as 缓存

    U->>A: 请求数据
    A->>C: 检查缓存
    alt 缓存命中
        C-->>A: 返回缓存数据
    else 缓存未命中
        A->>D: 查询数据库
        D-->>A: 返回数据
        A->>C: 更新缓存
    end
    A-->>U: 响应

Algorithm Complexity

算法复杂度

latex
\[
T(n) = \begin{cases}
O(1) & \text{best case} \\
O(\log n) & \text{average case} \\
O(n) & \text{worst case}
\end{cases}
\]

latex
\\[
T(n) = \\begin{cases}
O(1) & \\text{最佳情况} \\\\
O(\\log n) & \\text{平均情况} \\\\
O(n) & \\text{最坏情况}
\\end{cases}
\\]

Mathematical Formula

数学公式

typst
$ P(A|B) = (P(B|A) dot P(A)) / P(B) $
undefined
typst
$ P(A|B) = (P(B|A) dot P(A)) / P(B) $
undefined

Image Protocols

图片协议

bash
undefined
bash
undefined

Auto-detect best protocol

自动检测最佳协议

presenterm --image-protocol auto presentation.md
presenterm --image-protocol auto presentation.md

Use iTerm2 protocol

使用iTerm2协议

presenterm --image-protocol iterm2 presentation.md
presenterm --image-protocol iterm2 presentation.md

Use kitty protocol (local mode)

使用kitty协议(本地模式)

presenterm --image-protocol kitty-local presentation.md
presenterm --image-protocol kitty-local presentation.md

Use kitty protocol (remote mode)

使用kitty协议(远程模式)

presenterm --image-protocol kitty-remote presentation.md
presenterm --image-protocol kitty-remote presentation.md

Use sixel protocol

使用sixel协议

presenterm --image-protocol sixel presentation.md
presenterm --image-protocol sixel presentation.md

Use ASCII blocks (fallback)

使用ASCII块(降级方案)

presenterm --image-protocol ascii-blocks presentation.md
undefined
presenterm --image-protocol ascii-blocks presentation.md
undefined

Themes

主题

Built-in Themes

内置主题

bash
undefined
bash
undefined

List all available themes

列出所有可用主题

presenterm --list-themes
presenterm --list-themes

Common themes:

常用主题:

presenterm -t dark presentation.md presenterm -t light presentation.md presenterm -t catppuccin presentation.md presenterm -t dracula presentation.md presenterm -t gruvbox presentation.md presenterm -t monokai presentation.md presenterm -t nord presentation.md presenterm -t solarized-dark presentation.md presenterm -t solarized-light presentation.md
undefined
presenterm -t dark presentation.md presenterm -t light presentation.md presenterm -t catppuccin presentation.md presenterm -t dracula presentation.md presenterm -t gruvbox presentation.md presenterm -t monokai presentation.md presenterm -t nord presentation.md presenterm -t solarized-dark presentation.md presenterm -t solarized-light presentation.md
undefined

Custom Themes

自定义主题

bash
undefined
bash
undefined

Use custom theme from config

使用配置文件中的自定义主题

presenterm -c ~/.config/presenterm/config.yaml presentation.md presenterm --config-file custom-config.yaml presentation.md
undefined
presenterm -c ~/.config/presenterm/config.yaml presentation.md presenterm --config-file custom-config.yaml presentation.md
undefined

Speaker Notes Mode

演讲者备注模式

Publishing Speaker Notes

发布演讲者备注

bash
undefined
bash
undefined

Publish speaker notes to local network

将演讲者备注发布到本地网络

presenterm -P presentation.md presenterm --publish-speaker-notes presentation.md
presenterm -P presentation.md presenterm --publish-speaker-notes presentation.md

Listen for speaker notes (presenter's view)

监听演讲者备注(演示者视图)

presenterm -l presenterm --listen-speaker-notes

This allows you to:
- Run presentation on one screen
- View speaker notes on another device/screen
- Perfect for dual-monitor setups
presenterm -l presenterm --listen-speaker-notes

这允许你:
- 在一个屏幕上运行演示
- 在另一个设备/屏幕上查看演讲者备注
- 非常适合双显示器设置

Validation

验证

bash
undefined
bash
undefined

Validate that slides don't overflow terminal

验证幻灯片是否超出终端显示范围

presenterm --validate-overflows presentation.md
presenterm --validate-overflows presentation.md

Validate code snippets

验证代码片段

presenterm --validate-snippets presentation.md
presenterm --validate-snippets presentation.md

Combine validations

组合验证

presenterm --validate-overflows --validate-snippets presentation.md
undefined
presenterm --validate-overflows --validate-snippets presentation.md
undefined

Keyboard Controls

键盘控制

During Presentation

演示过程中

Navigation:
  ←/→         Previous/Next slide
  Space/Enter Next slide
  Backspace   Previous slide
  Home        First slide
  End         Last slide
  g           Go to specific slide (enter number)

Display:
  f           Toggle fullscreen
  q/Esc       Quit presentation

Code Execution:
  e           Execute code block (with -x flag)

Help:
  ?           Show help/controls
导航:
  ←/→         上一张/下一张幻灯片
  Space/Enter 下一张幻灯片
  Backspace   上一张幻灯片
  Home        第一张幻灯片
  End         最后一张幻灯片
  g           跳转到指定幻灯片(输入编号)

显示:
  f           切换全屏
  q/Esc       退出演示

代码执行:
  e           执行代码块(需使用-x参数)

帮助:
  ?           显示帮助/控制说明

Configuration

配置

Config File Location

配置文件位置

bash
undefined
bash
undefined

Default config locations:

默认配置文件位置:

- Linux: ~/.config/presenterm/config.yaml

- Linux: ~/.config/presenterm/config.yaml

- macOS: ~/Library/Application Support/presenterm/config.yaml

- macOS: ~/Library/Application Support/presenterm/config.yaml

- Windows: %APPDATA%\presenterm\config.yaml

- Windows: %APPDATA%\presenterm\config.yaml

Specify custom config

指定自定义配置文件

presenterm -c /path/to/config.yaml presentation.md
undefined
presenterm -c /path/to/config.yaml presentation.md
undefined

Example Configuration

示例配置

yaml
undefined
yaml
undefined

config.yaml

config.yaml

theme: catppuccin image_protocol: auto
theme: catppuccin image_protocol: auto

Default options

默认选项

presentation_mode: true validate_overflows: true
presentation_mode: true validate_overflows: true

Code execution

代码执行

enable_snippet_execution: false
undefined
enable_snippet_execution: false
undefined

Common Workflows

常见工作流

Workflow 1: Create Simple Presentation

工作流1:创建简单演示文稿

bash
undefined
bash
undefined

1. Create markdown file

1. 创建Markdown文件

cat > demo.md << 'EOF'
cat > demo.md << 'EOF'

Welcome

欢迎

A presenterm demo

presenterm演示



Key Features

核心特性

  • Terminal-based
  • Markdown syntax
  • Multiple themes
  • Export to PDF/HTML

  • 终端原生
  • Markdown语法
  • 多种主题
  • 导出为PDF/HTML

Thank You!

谢谢!

Questions? EOF
有问题吗? EOF

2. Run presentation

2. 运行演示

presenterm -p demo.md
presenterm -p demo.md

3. Export to PDF

3. 导出为PDF

presenterm -e demo.md -o demo.pdf
undefined
presenterm -e demo.md -o demo.pdf
undefined

Workflow 2: Technical Presentation with Code

工作流2:带代码的技术演示

bash
undefined
bash
undefined

1. Create presentation with code examples

1. 创建包含代码示例的演示文稿

cat > tech-talk.md << 'EOF'
cat > tech-talk.md << 'EOF'

Technical Deep Dive

技术深度解析

Rust Async Programming

Rust异步编程



Basic Example

基础示例

rust
async fn fetch_data() -> Result<String, Error> {
    let response = reqwest::get("https://api.example.com")
        .await?;
    response.text().await
}
<!-- presenter notes Explain async/await syntax Mention error handling -->
rust
async fn fetch_data() -> Result<String, Error> {
    let response = reqwest::get("https://api.example.com")
        .await?;
    response.text().await
}
<!-- presenter notes 解释async/await语法 提及错误处理 -->

Live Demo

实时演示

bash
cargo --version
rustc --version

bash
cargo --version
rustc --version

Questions?

有问题吗?

EOF
EOF

2. Present with code execution enabled

2. 启用代码执行功能进行演示

presenterm -x -p tech-talk.md
presenterm -x -p tech-talk.md

3. Validate before sharing

3. 分享前验证

presenterm --validate-overflows --validate-snippets tech-talk.md
presenterm --validate-overflows --validate-snippets tech-talk.md

4. Export for distribution

4. 导出用于分发

presenterm -e tech-talk.md -o tech-talk.pdf
undefined
presenterm -e tech-talk.md -o tech-talk.pdf
undefined

Workflow 3: Dual-Screen Presentation

工作流3:双屏幕演示

bash
undefined
bash
undefined

Terminal 1 (presenter view with notes)

终端1(带备注的演示者视图)

presenterm -P presentation.md
presenterm -P presentation.md

Terminal 2 (or another device - audience view)

终端2(或其他设备 - 观众视图)

presenterm -l
presenterm -l

This shows:

效果:

- Terminal 1: Full presentation with speaker notes visible

- 终端1:显示完整演示及演讲者备注

- Terminal 2: Synchronized view following presenter

- 终端2:同步跟随演示者的视图

undefined
undefined

Workflow 4: Themed Corporate Presentation

工作流4:企业主题演示

bash
undefined
bash
undefined

1. Create config with company theme

1. 创建包含公司主题的配置文件

mkdir -p ~/.config/presenterm cat > ~/.config/presenterm/config.yaml << 'EOF' theme: solarized-light presentation_mode: true validate_overflows: true EOF
mkdir -p ~/.config/presenterm cat > ~/.config/presenterm/config.yaml << 'EOF' theme: solarized-light presentation_mode: true validate_overflows: true EOF

2. Create presentation

2. 创建演示文稿

vim quarterly-review.md
vim quarterly-review.md

3. Preview with theme

3. 使用主题预览

presenterm quarterly-review.md
presenterm quarterly-review.md

4. Export with theme applied

4. 应用主题导出

presenterm -e quarterly-review.md -o quarterly-review.pdf
presenterm -e quarterly-review.md -o quarterly-review.pdf

5. Also export HTML version

5. 同时导出HTML版本

presenterm -E quarterly-review.md -o quarterly-review.html
undefined
presenterm -E quarterly-review.md -o quarterly-review.html
undefined

Workflow 5: Conference Talk

工作流5:会议演讲

markdown
undefined
markdown
undefined

Conference Talk Template

会议演讲模板



About Me

关于我

Profile
  • Name
  • Title
  • Company
  • Twitter: @handle
<!-- presenter notes - Smile at audience - Check time: should be at 2 minutes -->
个人头像
  • 姓名
  • 职位
  • 公司
  • Twitter: @handle
<!-- presenter notes - 对观众微笑 - 检查时间:应在2分钟时完成此页 -->

Agenda

议程

  1. Problem Statement
  2. Our Approach
  3. Demo
  4. Results
  5. Q&A

  1. 问题陈述
  2. 我们的方案
  3. 演示
  4. 结果
  5. 问答

Problem Statement

问题陈述

The Challenge

挑战

  • Point 1
  • Point 2
  • Point 3
<!-- presenter notes - Share personal experience - Ask if anyone relates -->
  • 要点1
  • 要点2
  • 要点3
<!-- presenter notes - 分享个人经验 - 询问是否有人有同感 -->

Live Demo

实时演示

bash
./demo.sh

bash
./demo.sh

Results

结果

MetricBeforeAfterImprovement
Speed100ms10ms10x
Memory500MB50MB10x

指标之前之后提升
速度100ms10ms10倍
内存500MB50MB10倍

Thank You!

谢谢!

Questions?

有问题吗?

Best Practices

最佳实践

Slide Design

幻灯片设计

  1. One idea per slide: Keep slides focused
  2. Minimal text: Use bullets, not paragraphs
  3. Visual hierarchy: Use headings effectively
  4. Code readability: Keep code snippets short and readable
  5. Consistent formatting: Use same style throughout
  1. 每张幻灯片一个核心观点:保持幻灯片聚焦
  2. 文字极简:使用项目符号,而非段落
  3. 视觉层次:有效使用标题
  4. 代码可读性:代码片段保持简短易读
  5. 格式一致:全程使用相同风格

File Organization

文件组织

presentation/
├── slides.md           # Main presentation
├── images/             # Image assets
│   ├── logo.png
│   ├── diagram1.png
│   └── screenshot.png
├── code/               # Code examples
│   ├── example1.rs
│   └── demo.py
└── export/             # Exported versions
    ├── slides.pdf
    └── slides.html
presentation/
├── slides.md           # 主演示文稿
├── images/             # 图片资源
│   ├── logo.png
│   ├── diagram1.png
│   └── screenshot.png
├── code/               # 代码示例
│   ├── example1.rs
│   └── demo.py
└── export/             # 导出版本
    ├── slides.pdf
    └── slides.html

Speaker Notes

演讲者备注

markdown
undefined
markdown
undefined

Slide Title

幻灯片标题

Visible content
<!-- presenter notes Time checkpoint: 5 minutes Key talking points: - Emphasize security aspect - Mention customer feedback - Transition to demo Reminder: drink water! -->
undefined
可见内容
<!-- presenter notes 时间节点:5分钟 核心演讲要点: - 强调安全方面 - 提及客户反馈 - 过渡到演示 提醒:喝水! -->
undefined

Code Examples

代码示例

  1. Syntax highlighting: Always specify language
  2. Keep it short: 10-15 lines max per slide
  3. Highlight key parts: Use comments to draw attention
  4. Test code: Ensure examples are correct
  5. Use exec sparingly: Only for impactful demos
  1. 语法高亮:始终指定语言
  2. 保持简短:每张幻灯片最多10-15行
  3. 高亮关键部分:使用注释吸引注意力
  4. 测试代码:确保示例正确
  5. 谨慎使用exec:仅用于有冲击力的演示

Validation Before Presenting

演示前验证

bash
undefined
bash
undefined

Full validation checklist

完整验证清单

presenterm --validate-overflows presentation.md presenterm --validate-snippets presentation.md presenterm -p presentation.md # Dry run presenterm -e presentation.md # Generate backup PDF
undefined
presenterm --validate-overflows presentation.md presenterm --validate-snippets presentation.md presenterm -p presentation.md # 预演 presenterm -e presentation.md # 生成备份PDF
undefined

Tips and Tricks

技巧和窍门

Quick Presentation Template

快速演示模板

bash
undefined
bash
undefined

Create new presentation from template

从模板创建新演示文稿

cat > new-talk.md << 'EOF'
cat > new-talk.md << 'EOF'

Talk Title

演讲标题

Subtitle

副标题

Your Name

你的姓名

Outline

大纲

  1. Introduction
  2. Main Content
  3. Conclusion

  1. 介绍
  2. 主要内容
  3. 结论

Section 1

第一部分

Content here

内容在这里

Thank You

谢谢

Questions? EOF
undefined
有问题吗? EOF
undefined

Rapid Iteration

快速迭代

bash
undefined
bash
undefined

Use watch for live reload during development

使用watch实现开发时实时重载

(requires 'entr' or 'watchexec')

(需要'install entr'或'watchexec')

With entr

使用entr

echo presentation.md | entr presenterm /_
echo presentation.md | entr presenterm /_

With watchexec

使用watchexec

watchexec -w presentation.md presenterm presentation.md
undefined
watchexec -w presentation.md presenterm presentation.md
undefined

Export All Formats

导出所有格式

bash
#!/bin/bash
bash
#!/bin/bash

export-all.sh - Export presentation to all formats

export-all.sh - 将演示文稿导出为所有格式

PRESENTATION="$1" BASENAME="${PRESENTATION%.md}"
echo "Exporting $PRESENTATION..."
PRESENTATION="$1" BASENAME="${PRESENTATION%.md}"
echo "正在导出 $PRESENTATION..."

PDF

PDF

presenterm -e "$PRESENTATION" -o "${BASENAME}.pdf" echo "✓ PDF exported"
presenterm -e "$PRESENTATION" -o "${BASENAME}.pdf" echo "✓ PDF导出完成"

HTML

HTML

presenterm -E "$PRESENTATION" -o "${BASENAME}.html" echo "✓ HTML exported"
echo "All exports complete!"
undefined
presenterm -E "$PRESENTATION" -o "${BASENAME}.html" echo "✓ HTML导出完成"
echo "所有导出完成!"
undefined

Presentation Checklist

演示检查清单

markdown
undefined
markdown
undefined

Pre-Presentation Checklist

演示前检查清单

Technical:
  • Run validation:
    presenterm --validate-overflows slides.md
  • Test code execution blocks
  • Verify images load correctly
  • Check font size visibility
  • Test on actual presentation screen
  • Export backup PDF
Content:
  • Timing (practice run-through)
  • Speaker notes complete
  • Transitions smooth
  • No typos
  • Links working
Setup:
  • Terminal font size readable
  • Theme appropriate for venue
  • Backup presentation on USB
  • Power adapter
  • HDMI/adapter cable
undefined
技术方面:
  • 运行验证:
    presenterm --validate-overflows slides.md
  • 测试代码执行块
  • 验证图片加载正常
  • 检查字体大小可见性
  • 在实际演示屏幕上测试
  • 导出备份PDF
内容方面:
  • 计时(预演一遍)
  • 演讲者备注完整
  • 过渡流畅
  • 无拼写错误
  • 链接可用
设置方面:
  • 终端字体大小可读
  • 主题适合场地
  • U盘备份演示文稿
  • 电源适配器
  • HDMI/转换线
undefined

Troubleshooting

故障排除

Images Not Displaying

图片无法显示

bash
undefined
bash
undefined

Try different image protocols

尝试不同的图片协议

presenterm --image-protocol iterm2 presentation.md presenterm --image-protocol kitty-local presentation.md presenterm --image-protocol ascii-blocks presentation.md # Fallback
presenterm --image-protocol iterm2 presentation.md presenterm --image-protocol kitty-local presentation.md presenterm --image-protocol ascii-blocks presentation.md # 降级方案

Check image paths are relative or absolute

检查图片路径是相对还是绝对路径

Ensure images exist

确保图片存在

ls -la images/
undefined
ls -la images/
undefined

Slides Overflow Terminal

幻灯片超出终端显示范围

bash
undefined
bash
undefined

Validate first

先验证

presenterm --validate-overflows presentation.md
presenterm --validate-overflows presentation.md

Solutions:

解决方案:

1. Reduce content per slide

1. 减少单张幻灯片内容

2. Increase terminal size

2. 增大终端尺寸

3. Use smaller font

3. 使用更小的字体

4. Break into multiple slides

4. 拆分为多张幻灯片

undefined
undefined

Code Execution Not Working

代码执行不工作

bash
undefined
bash
undefined

Ensure execution is enabled

确保已启用执行功能

presenterm -x presentation.md
presenterm -x presentation.md

Check script permissions

检查脚本权限

chmod +x script.sh
chmod +x script.sh

Test code block independently first

先独立测试代码块

undefined
undefined

Theme Not Applied

主题未应用

bash
undefined
bash
undefined

List available themes

列出可用主题

presenterm --list-themes
presenterm --list-themes

Check current theme

检查当前主题

presenterm --current-theme
presenterm --current-theme

Specify theme explicitly

显式指定主题

presenterm -t dark presentation.md
presenterm -t dark presentation.md

Check config file location

检查配置文件位置

ls -la ~/.config/presenterm/config.yaml
undefined
ls -la ~/.config/presenterm/config.yaml
undefined

Integration with Other Tools

与其他工具集成

With Git

与Git集成

bash
undefined
bash
undefined

Track presentations in version control

使用版本控制跟踪演示文稿

git init git add presentation.md images/ git commit -m "feat: add initial presentation"
git init git add presentation.md images/ git commit -m "feat: 添加初始演示文稿"

Create tagged releases for different versions

为不同版本创建标签

git tag -a v1.0 -m "Conference version"
undefined
git tag -a v1.0 -m "会议版本"
undefined

With make/just

与make/just集成

just
undefined
just
undefined

justfile

justfile

present: presenterm -p slides.md
export: presenterm -e slides.md -o output.pdf presenterm -E slides.md -o output.html
validate: presenterm --validate-overflows slides.md presenterm --validate-snippets slides.md
all: validate export
undefined
present: presenterm -p slides.md
export: presenterm -e slides.md -o output.pdf presenterm -E slides.md -o output.html
validate: presenterm --validate-overflows slides.md presenterm --validate-snippets slides.md
all: validate export
undefined

With Continuous Integration

与持续集成集成

yaml
undefined
yaml
undefined

.github/workflows/validate-presentation.yml

.github/workflows/validate-presentation.yml

name: Validate Presentation
on: [push, pull_request]
jobs: validate: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - name: Install presenterm run: cargo install presenterm - name: Validate slides run: | presenterm --validate-overflows presentation.md presenterm --validate-snippets presentation.md - name: Export PDF run: presenterm -e presentation.md -o presentation.pdf - name: Upload PDF uses: actions/upload-artifact@v2 with: name: presentation path: presentation.pdf
undefined
name: 验证演示文稿
on: [push, pull_request]
jobs: validate: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - name: 安装presenterm run: cargo install presenterm - name: 验证幻灯片 run: | presenterm --validate-overflows presentation.md presenterm --validate-snippets presentation.md - name: 导出PDF run: presenterm -e presentation.md -o presentation.pdf - name: 上传PDF uses: actions/upload-artifact@v2 with: name: presentation path: presentation.pdf
undefined

Quick Reference

快速参考

bash
undefined
bash
undefined

Basic usage

基础用法

presenterm slides.md # View presentation presenterm -p slides.md # Presentation mode presenterm -t dark slides.md # With theme
presenterm slides.md # 查看演示文稿 presenterm -p slides.md # 演示模式 presenterm -t dark slides.md # 使用主题

Export

导出

presenterm -e slides.md # Export to PDF presenterm -E slides.md # Export to HTML presenterm -e slides.md -o out.pdf # Custom output path
presenterm -e slides.md # 导出PDF presenterm -E slides.md # 导出HTML presenterm -e slides.md -o out.pdf # 自定义输出路径

Validation

验证

presenterm --validate-overflows slides.md presenterm --validate-snippets slides.md
presenterm --validate-overflows slides.md presenterm --validate-snippets slides.md

Code execution

代码执行

presenterm -x slides.md # Enable execution presenterm -X slides.md # Auto-replace execution
presenterm -x slides.md # 启用执行 presenterm -X slides.md # 自动替换执行

Themes

主题

presenterm --list-themes # List themes presenterm --current-theme # Show current theme
presenterm --list-themes # 列出主题 presenterm --current-theme # 查看当前主题

Speaker notes

演讲者备注

presenterm -P slides.md # Publish notes presenterm -l # Listen for notes
presenterm -P slides.md # 发布备注 presenterm -l # 监听备注

Help

帮助

presenterm --help # Full help presenterm --acknowledgements # Show acknowledgements presenterm -V # Version
undefined
presenterm --help # 完整帮助 presenterm --acknowledgements # 显示致谢 presenterm -V # 版本
undefined

Markdown Quick Reference

Markdown快速参考

markdown
undefined
markdown
undefined

Slide separator

幻灯片分隔符



Headings

标题

H1

H1

H2

H2

H3

H3

Lists

列表

  • Bullet point
    • Nested bullet
  1. Numbered item
  • 项目符号
    • 嵌套项目
  1. 编号项目

Code blocks

代码块

language
code here
``` (triple backtick)
language
代码内容
```(三个反引号)

Images

图片

Alt text
替代文本

Tables

表格

Col1Col2
AB
列1列2
AB

Quotes

引用

Quote text
引用文本

Speaker notes

演讲者备注

<!-- presenter notes Notes here -->
<!-- presenter notes 备注内容 -->

Executable code

可执行代码

bash
command
``` (triple backtick)
bash
命令
```(三个反引号)

Rendered diagrams

渲染图表

mermaid
graph TD
    A --> B
``` (triple backtick)

```d2 +render
A -> B
``` (triple backtick)
mermaid
graph TD
    A --> B
```(三个反引号)

```d2 +render
A -> B
```(三个反引号)

Rendered formulas

渲染公式

latex
\[ E = mc^2 \]
``` (triple backtick)

```typst +render
$ sum_(i=1)^n i = (n(n+1))/2 $
``` (triple backtick)
latex
\\[ E = mc^2 \\]
```(三个反引号)

```typst +render
$ sum_(i=1)^n i = (n(n+1))/2 $
```(三个反引号)

Resources

资源

Summary

总结

Primary directives:
  1. Write presentations in markdown
  2. Use presentation mode (
    -p
    ) for actual presentations
  3. Use advanced rendering: mermaid/d2 for diagrams, LaTeX/typst for formulas
  4. Include speaker notes for complex slides
  5. Validate before presenting
  6. Export to PDF/HTML for distribution
  7. Choose appropriate theme for venue/audience
  8. Keep slides simple and focused
  9. Test code execution and rendering blocks before presenting
Most common commands:
  • presenterm -p slides.md
    - Present
  • presenterm -e slides.md
    - Export PDF
  • presenterm -t theme slides.md
    - Use theme
  • presenterm --validate-overflows slides.md
    - Validate
  • presenterm --list-themes
    - See themes
Advanced rendering:
  • Mermaid diagrams:
     ```mermaid +render
    (requires mermaid-cli)
  • d2 diagrams:
     ```d2 +render
    (requires d2)
  • LaTeX formulas:
     ```latex +render
    (requires typst + pandoc)
  • Typst formulas:
     ```typst +render
    (requires typst)
核心要点:
  1. 使用Markdown编写演示文稿
  2. 实际演示时使用演示模式(
    -p
  3. 使用高级渲染:Mermaid/D2制作图表,LaTeX/Typst制作公式
  4. 复杂幻灯片添加演讲者备注
  5. 演示前进行验证
  6. 导出为PDF/HTML用于分发
  7. 根据场地/观众选择合适主题
  8. 保持幻灯片简洁聚焦
  9. 演示前测试代码执行和渲染块
最常用命令:
  • presenterm -p slides.md
    - 开始演示
  • presenterm -e slides.md
    - 导出PDF
  • presenterm -t theme slides.md
    - 使用指定主题
  • presenterm --validate-overflows slides.md
    - 验证幻灯片范围
  • presenterm --list-themes
    - 查看可用主题
高级渲染:
  • Mermaid图表:
     ```mermaid +render
    (需要mermaid-cli)
  • D2图表:
     ```d2 +render
    (需要d2)
  • LaTeX公式:
     ```latex +render
    (需要typst + pandoc)
  • Typst公式:
     ```typst +render
    (需要typst) ",