0
# CLI Commands
1
2
Command-line interface providing development server, build, export, and utility commands for Slidev presentations.
3
4
## Capabilities
5
6
### Default Development Server Command
7
8
Start a local development server for Slidev presentations with hot reloading and optional remote control.
9
10
```bash { .api }
11
slidev [entry]
12
slidev [entry] [options]
13
14
# Options:
15
--port, -p <number> # Port number (default: 3030)
16
--open, -o # Open in browser (default: false)
17
--remote <string> # Enable remote control with password
18
--tunnel # Enable Cloudflare Quick Tunnel (default: false)
19
--log <level> # Log level: error|warn|info|silent (default: warn)
20
--inspect # Enable inspect plugin for debugging (default: false)
21
--force, -f # Force optimizer to ignore cache (default: false)
22
--bind <string> # IP addresses to listen on in remote mode (default: 0.0.0.0)
23
--base <string> # Base URL (default: /)
24
--theme, -t <string> # Override theme
25
```
26
27
**Usage Examples:**
28
29
```bash
30
# Start with default slides.md
31
slidev
32
33
# Start with custom file
34
slidev my-presentation.md
35
36
# Start with custom port and auto-open
37
slidev --port 4000 --open
38
39
# Enable remote control
40
slidev --remote secretpassword
41
42
# Enable tunnel for external access
43
slidev --remote mypass --tunnel
44
45
# Force cache refresh
46
slidev --force
47
```
48
49
### Build Command
50
51
Build hostable Single Page Application (SPA) from Slidev presentations.
52
53
```bash { .api }
54
slidev build [entry..]
55
slidev build [entry..] [options]
56
57
# Options:
58
--out, -o <string> # Output directory (default: dist)
59
--base <string> # Output base URL (e.g., /demo/)
60
--download, -d # Allow PDF download in built site
61
--inspect # Enable inspect plugin for debugging (default: false)
62
--theme, -t <string> # Override theme
63
64
# Export options (inherited):
65
--output <string> # Path to output file
66
--format <string> # Output format: pdf|png|pptx|md
67
--timeout <number> # Timeout for rendering print page
68
--wait <number> # Wait time in ms before exporting
69
--wait-until <string> # Wait until event: networkidle|load|domcontentloaded|none
70
--range <string> # Page ranges (e.g., "1,4-5,6")
71
--dark # Export as dark theme
72
--with-clicks, -c # Export pages for every click
73
--executable-path <string> # Override Playwright browser executable
74
--with-toc # Export pages with outline
75
--per-slide # Export slide by slide (breaks cross-slide links)
76
--scale <number> # Scale factor for image export
77
--omit-background # Export PNG without browser background
78
```
79
80
**Usage Examples:**
81
82
```bash
83
# Build single presentation
84
slidev build
85
86
# Build multiple presentations
87
slidev build presentation1.md presentation2.md
88
89
# Build with custom output and download enabled
90
slidev build --out public --download
91
92
# Build with custom base URL for deployment
93
slidev build --base /presentations/
94
```
95
96
### Export Command
97
98
Export slides to PDF, PNG, PPTX, or Markdown formats using browser automation.
99
100
```bash { .api }
101
slidev export [entry..]
102
slidev export [entry..] [options]
103
104
# Options:
105
--output <string> # Path to output file
106
--format <string> # Output format: pdf|png|pptx|md (default: pdf)
107
--timeout <number> # Timeout for rendering print page (default: 30000)
108
--wait <number> # Wait time in ms before exporting (default: 0)
109
--wait-until <string> # Wait until event: networkidle|load|domcontentloaded|none
110
--range <string> # Page ranges to export (e.g., "1,4-5,6")
111
--dark # Export as dark theme
112
--with-clicks, -c # Export pages for every click animation
113
--executable-path <string> # Override Playwright browser executable
114
--with-toc # Export pages with table of contents
115
--per-slide # Export slide by slide (better for global components)
116
--scale <number> # Scale factor for image export
117
--omit-background # Export PNG pages without browser background
118
--theme, -t <string> # Override theme
119
```
120
121
**Usage Examples:**
122
123
```bash
124
# Export to PDF (default)
125
slidev export presentation.md
126
127
# Export to PNG images
128
slidev export --format png
129
130
# Export specific slide ranges
131
slidev export --range "1,3-5,10"
132
133
# Export with click animations
134
slidev export --with-clicks
135
136
# Export dark theme version
137
slidev export --dark
138
139
# Export with custom output name
140
slidev export --output my-slides.pdf
141
```
142
143
### Format Command
144
145
Format Markdown files according to Slidev's formatting rules and conventions.
146
147
```bash { .api }
148
slidev format [entry..]
149
150
# No additional options - formats in place
151
```
152
153
**Usage Examples:**
154
155
```bash
156
# Format single file
157
slidev format slides.md
158
159
# Format multiple files
160
slidev format presentation1.md presentation2.md notes.md
161
```
162
163
### Theme Commands
164
165
Theme management operations for ejecting and customizing themes.
166
167
```bash { .api }
168
slidev theme eject
169
slidev theme eject [options]
170
171
# Options:
172
--dir <string> # Output directory for ejected theme (default: theme)
173
--theme, -t <string> # Override theme to eject
174
```
175
176
**Usage Examples:**
177
178
```bash
179
# Eject current theme to ./theme directory
180
slidev theme eject
181
182
# Eject to custom directory
183
slidev theme eject --dir my-custom-theme
184
185
# Eject specific theme
186
slidev theme eject --theme @slidev/theme-default
187
```
188
189
### Export Notes Command
190
191
Export slide notes to PDF format for speaker reference.
192
193
```bash { .api }
194
slidev export-notes [entry..]
195
slidev export-notes [entry..] [options]
196
197
# Options:
198
--output <string> # Path to output file
199
--timeout <number> # Timeout for rendering (default: 30000)
200
--wait <number> # Wait time in ms before exporting (default: 0)
201
```
202
203
**Usage Examples:**
204
205
```bash
206
# Export notes for single presentation
207
slidev export-notes slides.md
208
209
# Export notes with custom output name
210
slidev export-notes --output speaker-notes.pdf
211
212
# Export notes for multiple presentations
213
slidev export-notes presentation1.md presentation2.md
214
```
215
216
## Common Options
217
218
### Entry File Specification
219
220
All commands accept entry file arguments with the following behavior:
221
222
- **Default**: `slides.md` if no entry specified
223
- **Multiple entries**: Supported by `build`, `export`, `format`, and `export-notes` commands
224
- **Auto-extension**: `.md` extension added automatically if missing
225
- **Creation prompt**: Offers to create file from template if it doesn't exist
226
227
### Theme Override
228
229
The `--theme` or `-t` option allows overriding the theme specified in the presentation's frontmatter:
230
231
```bash
232
slidev --theme @slidev/theme-seriph
233
slidev build --theme ./my-local-theme
234
```
235
236
### Remote Control Features
237
238
When using `--remote` option:
239
240
- Generates QR code for mobile device access
241
- Provides network interface URLs for remote access
242
- Supports `--tunnel` for internet access via Cloudflare
243
- Requires `--bind` to specify listening interfaces in remote mode
244
245
### Development Server Shortcuts
246
247
When running the development server, keyboard shortcuts are available:
248
249
- `r` - Restart server
250
- `o` - Open in browser
251
- `e` - Edit presentation (opens in VS Code)
252
- `q` - Quit server
253
- `c` - Show QR code (when remote enabled)
254
255
## Error Cases
256
257
**Common error scenarios:**
258
259
- **Missing entry file**: Prompts to create from template
260
- **Invalid theme**: Shows available themes or installation instructions
261
- **Port conflicts**: Automatically finds available port in range 3030-4000
262
- **Export failures**: Usually indicates missing Playwright dependencies
263
- **Build failures**: Often related to theme or asset resolution issues
264
265
**Troubleshooting commands:**
266
267
```bash
268
# Check dependencies
269
npm ls @slidev/cli
270
271
# Force cache clear
272
slidev --force
273
274
# Enable debug logging
275
slidev --log info
276
```