fn fit(slides?: string, bottomMargin?: number, rightMargin?: number, screenshots?: enum, shotsDir?: string, timeoutMs?: number)
Open every slide with all clicks revealed and flag content that runs off the bottom or right edge or scrolls, with screenshots
| Argument | Type | Required | Description |
|---|
| slides? | string | no | Only check these slide numbers, e.g. '12' or '3,7,10-14' |
| bottomMargin? | number | no | Flag content that reaches within this many slide pixels of the bottom edge |
| rightMargin? | number | no | Flag content that reaches within this many slide pixels of the right edge (the slide is 980 wide) |
| screenshots? | enum | no | Which slides to screenshot |
| shotsDir? | string | no | Also copy the screenshots into this host directory (created if needed) |
| timeoutMs? | number | no | Overall timeout, including a first-run npm install |
fn serve(port?: number, remote?: boolean, timeoutMs?: number)
Start the dev server in a background container (slidev --remote by default) and wait until it answers
| Argument | Type | Required | Description |
|---|
| port? | number | no | Host port to publish the dev server on |
| remote? | boolean | no | Pass --remote so other devices on the network can follow along and control the deck |
| timeoutMs? | number | no | How long to wait for the server to answer, including a first-run npm install |
fn stop(timeoutMs?: number)
Stop the background dev server started by serve
| Argument | Type | Required | Description |
|---|
| timeoutMs? | number | no | Timeout for the command |
fn outdated(timeoutMs?: number)
List packages with newer versions (npm outdated)
| Argument | Type | Required | Description |
|---|
| timeoutMs? | number | no | Timeout for the command |
fn upgrade(packages?: array, playwright?: boolean, timeoutMs?: number)
Move Slidev, its themes, vue and playwright-chromium to their latest versions (npm install <pkg>@latest), adding playwright-chromium if missing
| Argument | Type | Required | Description |
|---|
| packages? | array | no | Packages to move to @latest. Default: every @slidev/* package, vue and playwright-chromium in package.json, except ones pinned to an exact version |
| playwright? | boolean | no | Add playwright-chromium as a dev dependency if it is missing (fit and export need it) |
| timeoutMs? | number | no | Timeout for the npm installs |
fn build(timeoutMs?: number)
Check that the deck builds for production (slidev build), as a Pages deploy would; fails with the build log if it doesn't
| Argument | Type | Required | Description |
|---|
| timeoutMs? | number | no | Timeout for the command |
fn export(withClicks?: boolean, dark?: boolean, timeoutMs?: number)
Export the deck to PDF (slidev export)
| Argument | Type | Required | Description |
|---|
| withClicks? | boolean | no | One page per click step instead of one per slide |
| dark? | boolean | no | Export in dark mode |
| timeoutMs? | number | no | Timeout for the export |
fn init(playwright?: boolean, timeoutMs?: number)
Create a new Slidev deck at dir from the official template (npm init slidev), with playwright-chromium
| Argument | Type | Required | Description |
|---|
| playwright? | boolean | no | Add playwright-chromium so fit and export work straight away |
| timeoutMs? | number | no | Timeout for creating the deck and installing packages |
fn scaffold(title: string, author?: string, email?: string, license?: boolean, copyright?: string, lockfileFrom?: string, timeoutMs?: number)
Add page numbers, a GitHub Pages deploy workflow, README, LICENSE and a starter slides.md to a deck from init, then git init and commit
| Argument | Type | Required | Description |
|---|
| title | string | yes | Deck title, used for the cover slide and the README |
| author? | string | no | Author on the cover slide. Default: git config user.name |
| email? | string | no | Email on the cover slide; omitted when not given |
| license? | boolean | no | Write LICENSE: code under Apache-2.0, slides under CC BY 4.0 |
| copyright? | string | no | Copyright holder for the first line of LICENSE |
| lockfileFrom? | string | no | Path of a deck that builds; its package-lock.json and dependency versions are copied in and installed with npm ci, to work around a broken upstream release |
| timeoutMs? | number | no | Timeout for npm ci when lockfileFrom is given |
fn push(remoteUrl: string, branch?: string)
Push the deck to a remote as origin (adding origin if it's missing) and set the branch to track it
| Argument | Type | Required | Description |
|---|
| remoteUrl | string | yes | Remote to push to as origin, e.g. git@github.com:<owner>/<name>.git |
| branch? | string | no | Branch to push |
Resources
fit(infinite)— Slide fit report: every checked slide's extent and the flagged ones (instance fit)
server(infinite)— The background dev server from serve/stop (instance server)
outdated(infinite)— Packages with newer versions (instance outdated)
upgrade(infinite)— Versions changed by an upgrade (instance upgrade)
deck(infinite)— The deck created by init (instance deck)
build(infinite)— The last production build check (instance build)
scaffold(infinite)— Files scaffold added and the first commit (instance scaffold)
push(infinite)— The last push to the remote (instance push)