返回 slidev
core-cli.md
根目录 / skills / slidev / references / core-cli.md
1 ---
2 name: cli
3 description: Slidev command-line interface reference
4 ---
5
6 # CLI Commands
7
8 Slidev command-line interface reference.
9
10 ## Dev Server
11
12 ```bash
13 slidev [entry]
14 slidev slides.md
15 ```
16
17 Options:
18 | Option | Default | Description |
19 |--------|---------|-------------|
20 | `--port` | 3030 | Server port |
21 | `--open` | false | Open browser |
22 | `--remote [password]` | - | Enable remote access |
23 | `--bind` | 0.0.0.0 | Bind address |
24 | `--base` | / | Base URL path |
25 | `--log` | warn | Log level |
26 | `--force` | false | Force optimizer re-bundle |
27 | `--theme` | - | Override theme |
28
29 Examples:
30 ```bash
31 slidev --port 8080 --open
32 slidev --remote mypassword
33 slidev --base /talks/my-talk/
34 ```
35
36 ## Build
37
38 ```bash
39 slidev build [entry]
40 ```
41
42 Options:
43 | Option | Default | Description |
44 |--------|---------|-------------|
45 | `--out` | dist | Output directory |
46 | `--base` | / | Base URL for deployment |
47 | `--download` | false | Include PDF download |
48 | `--theme` | - | Override theme |
49 | `--without-notes` | false | Exclude presenter notes |
50
51 Examples:
52 ```bash
53 slidev build --base /my-repo/
54 slidev build --download --out public
55 slidev build slides1.md slides2.md # Multiple builds
56 ```
57
58 ## Export
59
60 ```bash
61 slidev export [entry]
62 ```
63
64 Options:
65 | Option | Default | Description |
66 |--------|---------|-------------|
67 | `--output` | - | Output filename |
68 | `--format` | pdf | pdf / png / pptx / md |
69 | `--timeout` | 30000 | Timeout per slide (ms) |
70 | `--range` | - | Slide range (e.g., 1,4-7) |
71 | `--dark` | false | Export dark mode |
72 | `--with-clicks` | false | Include click steps |
73 | `--with-toc` | false | PDF table of contents |
74 | `--wait` | 0 | Wait ms before export |
75 | `--wait-until` | networkidle | Wait condition |
76 | `--omit-background` | false | Transparent background |
77 | `--executable-path` | - | Browser path |
78
79 Examples:
80 ```bash
81 slidev export
82 slidev export --format pptx
83 slidev export --format png --range 1-5
84 slidev export --with-clicks --dark
85 slidev export --timeout 60000 --wait 2000
86 ```
87
88 ## Format
89
90 ```bash
91 slidev format [entry]
92 ```
93
94 Formats the slides markdown file.
95
96 ## MCP Server
97
98 ```bash
99 slidev mcp [entry]
100 ```
101
102 Starts an MCP (Model Context Protocol) server over stdio for AI agents to inspect and edit the slides. When a dev server is running, an HTTP MCP endpoint is also available at `http://localhost:<port>/__mcp`. See [tool-mcp](tool-mcp.md).
103
104 ## Theme Eject
105
106 ```bash
107 slidev theme eject [entry]
108 ```
109
110 Options:
111 | Option | Default | Description |
112 |--------|---------|-------------|
113 | `--dir` | theme | Output directory |
114 | `--theme` | - | Theme to eject |
115
116 Extracts theme to local directory for customization.
117
118 ## npm Script Usage
119
120 In package.json:
121 ```json
122 {
123 "scripts": {
124 "dev": "slidev",
125 "build": "slidev build",
126 "export": "slidev export"
127 }
128 }
129 ```
130
131 With arguments (note `--`):
132 ```bash
133 npm run dev -- --port 8080 --open
134 npm run export -- --format pptx
135 ```
136
137 ## Boolean Options
138
139 ```bash
140 slidev --open # Same as --open true
141 slidev --no-open # Same as --open false
142 ```
143
144 ## Install CLI Globally
145
146 ```bash
147 npm i -g @slidev/cli
148 ```
149
149 lines MARKDOWN