返回 slidev
SKILL.md
根目录 / skills / slidev / SKILL.md
1 ---
2 name: slidev
3 description: Create and present web-based slidedecks for developers using Slidev with Markdown, Vue components, code highlighting, animations, and interactive features. Use when building technical presentations, conference talks, code walkthroughs, teaching materials, or developer decks.
4 ---
5
6 # Slidev - Presentation Slides for Developers
7
8 Web-based slides maker built on Vite, Vue, and Markdown.
9
10 ## When to Use
11
12 - Technical presentations or slidedecks with live code examples
13 - Syntax-highlighted code snippets with animations
14 - Interactive demos (Monaco editor, runnable code)
15 - Mathematical equations (LaTeX) or diagrams (Mermaid, PlantUML)
16 - Record presentations with presenter notes
17 - Export to PDF, PPTX, or host as SPA
18 - Code walkthroughs for developer talks or workshops
19
20 ## Prerequisites
21
22 Slidev is a Node.js project. Before creating or running a deck, check that the machine has:
23
24 - **Node.js >= 22.12.0**: `node -v`. If it is missing or older, install the LTS release from https://nodejs.org or use a version manager such as `nvm` or `fnm`.
25 - **pnpm** (recommended package manager): `pnpm -v`. If it is missing, run `npm i -g pnpm` or `corepack enable`. npm, yarn, and bun also work; replace `pnpm` in the commands below.
26
27 Do not assume a development setup exists. If either check fails, walk the user through the installation before running any Slidev command.
28
29 ## Quick Start
30
31 ```bash
32 pnpm create slidev # Create project
33 pnpm run dev # Start dev server (opens http://localhost:3030)
34 pnpm run build # Build static SPA
35 pnpm run export # Export to PDF (requires playwright-chromium)
36 ```
37
38 **Verify**: After `pnpm run dev`, confirm slides load at `http://localhost:3030`. After `pnpm run export`, check the output PDF exists in the project root.
39
40 ## Basic Syntax
41
42 ```md
43 ---
44 theme: default
45 title: My Presentation
46 ---
47
48 # First Slide
49
50 Content here
51
52 ---
53
54 # Second Slide
55
56 More content
57
58 <!--
59 Presenter notes go here
60 -->
61 ```
62
63 - `---` separates slides
64 - First frontmatter = headmatter (deck config)
65 - HTML comments = presenter notes
66
67 ## Core References
68
69 | Topic | Description | Reference |
70 |-------|-------------|-----------|
71 | Markdown Syntax | Slide separators, frontmatter, notes, code blocks | [core-syntax](references/core-syntax.md) |
72 | Animations | v-click, v-clicks, motion, transitions | [core-animations](references/core-animations.md) |
73 | Headmatter | Deck-wide configuration options | [core-headmatter](references/core-headmatter.md) |
74 | Frontmatter | Per-slide configuration options | [core-frontmatter](references/core-frontmatter.md) |
75 | CLI Commands | Dev, build, export, theme commands | [core-cli](references/core-cli.md) |
76 | Components | Built-in Vue components | [core-components](references/core-components.md) |
77 | Layouts | Built-in slide layouts | [core-layouts](references/core-layouts.md) |
78 | Exporting | PDF, PPTX, PNG export options | [core-exporting](references/core-exporting.md) |
79 | Hosting | Build and deploy to various platforms | [core-hosting](references/core-hosting.md) |
80 | Global Context | $nav, $slidev, composables API | [core-global-context](references/core-global-context.md) |
81
82 ## Feature Reference
83
84 ### Code & Editor
85
86 | Feature | Usage | Reference |
87 |---------|-------|-----------|
88 | Line highlighting | `` ```ts {2,3} `` | [code-line-highlighting](references/code-line-highlighting.md) |
89 | Click-based highlighting | `` ```ts {1\|2-3\|all} `` | [code-line-highlighting](references/code-line-highlighting.md) |
90 | Line numbers | `lineNumbers: true` or `{lines:true}` | [code-line-numbers](references/code-line-numbers.md) |
91 | Scrollable code | `{maxHeight:'100px'}` | [code-max-height](references/code-max-height.md) |
92 | Code tabs | `::code-group` (requires `comark: true`) | [code-groups](references/code-groups.md) |
93 | Monaco editor | `` ```ts {monaco} `` | [editor-monaco](references/editor-monaco.md) |
94 | Run code | `` ```ts {monaco-run} `` | [editor-monaco-run](references/editor-monaco-run.md) |
95 | Edit files | `<<< ./file.ts {monaco-write}` | [editor-monaco-write](references/editor-monaco-write.md) |
96 | Code animations | `` ````md magic-move `` | [code-magic-move](references/code-magic-move.md) |
97 | TypeScript types | `` ```ts twoslash `` | [code-twoslash](references/code-twoslash.md) |
98 | Import code | `<<< @/snippets/file.js` | [code-import-snippet](references/code-import-snippet.md) |
99
100 ### Diagrams & Math
101
102 | Feature | Usage | Reference |
103 |---------|-------|-----------|
104 | Mermaid diagrams | `` ```mermaid `` | [diagram-mermaid](references/diagram-mermaid.md) |
105 | PlantUML diagrams | `` ```plantuml `` | [diagram-plantuml](references/diagram-plantuml.md) |
106 | LaTeX math | `$inline$` or `$$block$$` | [diagram-latex](references/diagram-latex.md) |
107
108 ### Layout & Styling
109
110 | Feature | Usage | Reference |
111 |---------|-------|-----------|
112 | Canvas size | `canvasWidth`, `aspectRatio` | [layout-canvas-size](references/layout-canvas-size.md) |
113 | Zoom slide | `zoom: 0.8` | [layout-zoom](references/layout-zoom.md) |
114 | Scale elements | `<Transform :scale="0.5">` | [layout-transform](references/layout-transform.md) |
115 | Layout slots | `::right::`, `::default::` | [layout-slots](references/layout-slots.md) |
116 | Scoped CSS | `<style>` in slide | [style-scoped](references/style-scoped.md) |
117 | Global layers | `global-top.vue`, `global-bottom.vue` | [layout-global-layers](references/layout-global-layers.md) |
118 | Draggable elements | `v-drag`, `<v-drag>` | [layout-draggable](references/layout-draggable.md) |
119 | Icons | `<mdi-icon-name />` | [style-icons](references/style-icons.md) |
120
121 ### Animation & Interaction
122
123 | Feature | Usage | Reference |
124 |---------|-------|-----------|
125 | Click animations | `v-click`, `<v-clicks>` | [core-animations](references/core-animations.md) |
126 | Rough markers | `v-mark.underline`, `v-mark.circle` | [animation-rough-marker](references/animation-rough-marker.md) |
127 | Drawing mode | Press `C` or config `drawings:` | [animation-drawing](references/animation-drawing.md) |
128 | Direction styles | `forward:delay-300` | [style-direction](references/style-direction.md) |
129 | Note highlighting | `[click]` in notes | [animation-click-marker](references/animation-click-marker.md) |
130
131 ### Syntax Extensions
132
133 | Feature | Usage | Reference |
134 |---------|-------|-----------|
135 | Comark syntax | `comark: true` + `{style="color:red"}` | [syntax-comark](references/syntax-comark.md) |
136 | Block frontmatter | `` ```yaml `` instead of `---` | [syntax-block-frontmatter](references/syntax-block-frontmatter.md) |
137 | Import slides | `src: ./other.md` | [syntax-importing-slides](references/syntax-importing-slides.md) |
138 | Merge frontmatter | Main entry wins | [syntax-frontmatter-merging](references/syntax-frontmatter-merging.md) |
139
140 ### Presenter & Recording
141
142 | Feature | Usage | Reference |
143 |---------|-------|-----------|
144 | Recording | Press `G` for camera | [presenter-recording](references/presenter-recording.md) |
145 | Timer | `duration: 30min`, `timer: countdown` | [presenter-timer](references/presenter-timer.md) |
146 | Remote control | `slidev --remote` | [presenter-remote](references/presenter-remote.md) |
147 | Ruby text | `notesAutoRuby:` | [presenter-notes-ruby](references/presenter-notes-ruby.md) |
148
149 ### Export & Build
150
151 | Feature | Usage | Reference |
152 |---------|-------|-----------|
153 | Export options | `slidev export` | [core-exporting](references/core-exporting.md) |
154 | Build & deploy | `slidev build` | [core-hosting](references/core-hosting.md) |
155 | Build with PDF | `download: true` | [build-pdf](references/build-pdf.md) |
156 | Cache images | Automatic for remote URLs | [build-remote-assets](references/build-remote-assets.md) |
157 | OG image | `seoMeta.ogImage` or `og-image.png` | [build-og-image](references/build-og-image.md) |
158 | SEO tags | `seoMeta:` | [build-seo-meta](references/build-seo-meta.md) |
159
160 **Export prerequisite**: `pnpm add -D playwright-chromium` is required for PDF/PPTX/PNG export. If export fails with a browser error, install this dependency first.
161
162 ### Editor & Tools
163
164 | Feature | Usage | Reference |
165 |---------|-------|-----------|
166 | Side editor | Click edit icon | [editor-side](references/editor-side.md) |
167 | VS Code extension | Install `antfu.slidev` | [editor-vscode](references/editor-vscode.md) |
168 | Prettier | `prettier-plugin-slidev` | [editor-prettier](references/editor-prettier.md) |
169 | Eject theme | `slidev theme eject` | [tool-eject-theme](references/tool-eject-theme.md) |
170 | MCP server (AI agents) | `http://localhost:<port>/__mcp` or `slidev mcp` | [tool-mcp](references/tool-mcp.md) |
171
172 ### Lifecycle & API
173
174 | Feature | Usage | Reference |
175 |---------|-------|-----------|
176 | Slide hooks | `onSlideEnter()`, `onSlideLeave()` | [api-slide-hooks](references/api-slide-hooks.md) |
177 | Navigation API | `$nav`, `useNav()` | [core-global-context](references/core-global-context.md) |
178
179 ## Common Layouts
180
181 | Layout | Purpose |
182 |--------|---------|
183 | `cover` | Title/cover slide |
184 | `center` | Centered content |
185 | `default` | Standard slide |
186 | `two-cols` | Two columns (use `::right::`) |
187 | `two-cols-header` | Header + two columns |
188 | `image` / `image-left` / `image-right` | Image layouts |
189 | `iframe` / `iframe-left` / `iframe-right` | Embed URLs |
190 | `quote` | Quotation |
191 | `section` | Section divider |
192 | `fact` / `statement` | Data/statement display |
193 | `intro` / `end` | Intro/end slides |
194
195 ## Resources
196
197 - Documentation: https://sli.dev
198 - Theme Gallery: https://sli.dev/resources/theme-gallery
199 - Showcases: https://sli.dev/resources/showcases
200
200 lines MARKDOWN