Skip to content

Commit 87e46ef

Browse files
authored
feat: add doc for CLI commands (#67)
1 parent 0305762 commit 87e46ef

File tree

2 files changed

+87
-0
lines changed

2 files changed

+87
-0
lines changed

custom/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ You can configure Slidev in the frontmatter of your first slide, the following s
99
```yaml
1010
---
1111
# theme id or package name
12+
# Learn more: https://sli.dev/themes/use.html
1213
theme: 'default'
1314
# title of your slide, will auto infer from the first header if not specified
1415
title: 'Slidev'

guide/install.md

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,3 +136,89 @@ You can visit your slides from http://localhost/
136136

137137

138138
Refer to the [tangramor/slidev_docker](https://github.com/tangramor/slidev_docker) for more details.
139+
140+
### Command Line Interface (CLI)
141+
142+
`@slidev/cli` Expose a few commands you can use with `npx slidev ...` or by adding scripts in your `package.json`:
143+
```json
144+
{
145+
"script": {
146+
"dev": "slidev"
147+
}
148+
}
149+
```
150+
151+
In that case you will be able to run `npm run dev`.
152+
153+
You can pass options to any commands:
154+
155+
* boolean option are `true` if they are present, false otherwise (example: `slidev --open`)
156+
* some options can have values you can add just after the option or by using the `=` character (example: `slidev --port 8080` or `slidev --port=8080`)
157+
158+
If you use npm scripts, don't forget to add `--` after the npm command:
159+
```bash
160+
npm run slidev -- --open
161+
```
162+
163+
#### `slidev [entry]`
164+
165+
Start a local server for Slidev.
166+
167+
* `[entry]` (`string`, default: `slides.md`): path to the slides markdown entry.
168+
169+
Options:
170+
171+
* `--port`, `-p` (`number`, default: `3030`): port number.
172+
* `--open`, `-o` (`boolean`, default: `false`): open in browser.
173+
* `--remote [password]` (`string`): listen to public host and enable remote control, if a value is passed then the presenter mode is private and only accessible by passing the given password in the URL query `password` parameter.
174+
* `--log` (`'error', 'warn', 'info', 'silent'`, default: `'warn'`): Log level.
175+
* `--force`, `-f` (`boolean`, default `false`): force the optimizer to ignore the cache and re-bundle.
176+
* `--theme`, `-t` (`string`): override theme.
177+
178+
#### `slidev build [entry]`
179+
180+
Build hostable SPA.
181+
182+
* `[entry]` (`string`, default: `slides.md`): path to the slides markdown entry.
183+
184+
Options:
185+
186+
* `--watch`, `-w` (`boolean`, default: `false`): build watch.
187+
* `--out`, `-o` (`string`, default: `dist`): output dir.
188+
* `--base` (`string`, default: `/`): base URL (see https://cli.vuejs.org/config/#publicpath)
189+
* `--download` (`boolean`, default: `false`): allow to download the slides as PDF inside the SPA.
190+
* `--theme`, `-t` (`string`): override theme.
191+
192+
#### `slidev export [entry]`
193+
194+
Export slides to PDF (or other format).
195+
196+
* `[entry]` (`string`, default: `slides.md`): path to the slides markdown entry.
197+
198+
Options:
199+
200+
* `--output` (`string`, default: use `exportFilename` (see https://sli.dev/custom/#frontmatter-configures) or use `[entry]-export`): path to the output.
201+
* `--base` (`'pdf', 'png', 'md'`, default: `'pdf'`): output format.
202+
* `--timeout` (`number`, default: `30000`): timeout for rendering the print page (see https://playwright.dev/docs/api/class-page#page-goto).
203+
* `--range` (`string`): page ranges to export (example: `'1,4-5,6'`).
204+
* `--dark` (`boolean`, default: `false`): export as dark theme.
205+
* `--with-clicks`, `-c` (`boolean`, default: `false`): export pages for every clicks (see https://sli.dev/guide/animations.html#click-animations).
206+
* `--theme`, `-t` (`string`): override theme.
207+
208+
#### `slidev format [entry]`
209+
210+
Format the markdown file.
211+
212+
* `[entry]` (`string`, default: `slides.md`): path to the slides markdown entry.
213+
214+
#### `slidev theme [subcommand]`
215+
216+
Theme related operations.
217+
218+
Subcommands:
219+
220+
* `eject [entry]`: Eject current theme into local file system
221+
* `[entry]` (`string`, default: `slides.md`): path to the slides markdown entry.
222+
* Options:
223+
* `--dir` (`string`, default: `theme`): output dir.
224+
* `--theme`, `-t` (`string`): override theme.

0 commit comments

Comments
 (0)