@slidev/cli 52.11.4 → 52.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{build-CoOI8nIf.mjs → build-DencOEqt.mjs} +1 -1
- package/dist/cli.mjs +3 -3
- package/dist/index.mjs +2 -2
- package/dist/{serve-Jnml-HZ7.mjs → serve-BptRm0xv.mjs} +1 -1
- package/dist/{shared-C72EYint.mjs → shared-mR4BGOPs.mjs} +36 -11
- package/package.json +5 -4
- package/skills/GENERATION.md +227 -0
- package/skills/slidev/README.md +61 -0
- package/skills/slidev/SKILL.md +183 -0
- package/skills/slidev/references/animation-click-marker.md +37 -0
- package/skills/slidev/references/animation-drawing.md +68 -0
- package/skills/slidev/references/animation-rough-marker.md +53 -0
- package/skills/slidev/references/api-slide-hooks.md +37 -0
- package/skills/slidev/references/build-og-image.md +36 -0
- package/skills/slidev/references/build-pdf.md +40 -0
- package/skills/slidev/references/build-remote-assets.md +34 -0
- package/skills/slidev/references/build-seo-meta.md +43 -0
- package/skills/slidev/references/code-groups.md +64 -0
- package/skills/slidev/references/code-import-snippet.md +55 -0
- package/skills/slidev/references/code-line-highlighting.md +50 -0
- package/skills/slidev/references/code-line-numbers.md +46 -0
- package/skills/slidev/references/code-magic-move.md +57 -0
- package/skills/slidev/references/code-max-height.md +37 -0
- package/skills/slidev/references/code-twoslash.md +42 -0
- package/skills/slidev/references/core-animations.md +196 -0
- package/skills/slidev/references/core-cli.md +140 -0
- package/skills/slidev/references/core-components.md +197 -0
- package/skills/slidev/references/core-exporting.md +148 -0
- package/skills/slidev/references/core-frontmatter.md +195 -0
- package/skills/slidev/references/core-global-context.md +155 -0
- package/skills/slidev/references/core-headmatter.md +188 -0
- package/skills/slidev/references/core-hosting.md +152 -0
- package/skills/slidev/references/core-layouts.md +286 -0
- package/skills/slidev/references/core-syntax.md +155 -0
- package/skills/slidev/references/diagram-latex.md +55 -0
- package/skills/slidev/references/diagram-mermaid.md +44 -0
- package/skills/slidev/references/diagram-plantuml.md +45 -0
- package/skills/slidev/references/editor-monaco-run.md +44 -0
- package/skills/slidev/references/editor-monaco-write.md +24 -0
- package/skills/slidev/references/editor-monaco.md +50 -0
- package/skills/slidev/references/editor-prettier.md +40 -0
- package/skills/slidev/references/editor-side.md +23 -0
- package/skills/slidev/references/editor-vscode.md +55 -0
- package/skills/slidev/references/layout-canvas-size.md +25 -0
- package/skills/slidev/references/layout-draggable.md +57 -0
- package/skills/slidev/references/layout-global-layers.md +50 -0
- package/skills/slidev/references/layout-slots.md +75 -0
- package/skills/slidev/references/layout-transform.md +33 -0
- package/skills/slidev/references/layout-zoom.md +39 -0
- package/skills/slidev/references/presenter-notes-ruby.md +35 -0
- package/skills/slidev/references/presenter-recording.md +30 -0
- package/skills/slidev/references/presenter-remote.md +40 -0
- package/skills/slidev/references/presenter-timer.md +34 -0
- package/skills/slidev/references/style-direction.md +34 -0
- package/skills/slidev/references/style-icons.md +46 -0
- package/skills/slidev/references/style-scoped.md +50 -0
- package/skills/slidev/references/syntax-block-frontmatter.md +39 -0
- package/skills/slidev/references/syntax-frontmatter-merging.md +49 -0
- package/skills/slidev/references/syntax-importing-slides.md +60 -0
- package/skills/slidev/references/syntax-mdc.md +51 -0
- package/skills/slidev/references/tool-eject-theme.md +27 -0
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: frontmatter
|
|
3
|
+
description: Configuration options for individual slides
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Per-Slide Frontmatter
|
|
7
|
+
|
|
8
|
+
Configuration options for individual slides.
|
|
9
|
+
|
|
10
|
+
## Layout
|
|
11
|
+
|
|
12
|
+
```yaml
|
|
13
|
+
---
|
|
14
|
+
layout: center
|
|
15
|
+
---
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
Available layouts: `default`, `cover`, `center`, `two-cols`, `two-cols-header`, `image`, `image-left`, `image-right`, `iframe`, `iframe-left`, `iframe-right`, `quote`, `section`, `statement`, `fact`, `full`, `intro`, `end`, `none`
|
|
19
|
+
|
|
20
|
+
## Background
|
|
21
|
+
|
|
22
|
+
```yaml
|
|
23
|
+
---
|
|
24
|
+
background: /image.jpg
|
|
25
|
+
backgroundSize: cover
|
|
26
|
+
class: text-white
|
|
27
|
+
---
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Click Count
|
|
31
|
+
|
|
32
|
+
```yaml
|
|
33
|
+
---
|
|
34
|
+
clicks: 5 # Total clicks for this slide
|
|
35
|
+
clicksStart: 0 # Starting click number
|
|
36
|
+
---
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Transitions
|
|
40
|
+
|
|
41
|
+
```yaml
|
|
42
|
+
---
|
|
43
|
+
transition: fade # Slide transition
|
|
44
|
+
---
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Or different for forward/backward:
|
|
48
|
+
|
|
49
|
+
```yaml
|
|
50
|
+
---
|
|
51
|
+
transition: slide-left | slide-right
|
|
52
|
+
---
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Zoom
|
|
56
|
+
|
|
57
|
+
```yaml
|
|
58
|
+
---
|
|
59
|
+
zoom: 0.8 # Scale content (0.8 = 80%)
|
|
60
|
+
---
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## Hide Slide
|
|
64
|
+
|
|
65
|
+
```yaml
|
|
66
|
+
---
|
|
67
|
+
disabled: true # Hide this slide
|
|
68
|
+
# or
|
|
69
|
+
hide: true
|
|
70
|
+
---
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## Table of Contents
|
|
74
|
+
|
|
75
|
+
```yaml
|
|
76
|
+
---
|
|
77
|
+
hideInToc: true # Hide from Toc component
|
|
78
|
+
level: 2 # Override heading level
|
|
79
|
+
title: Custom Title # Override slide title
|
|
80
|
+
---
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
## Import External File
|
|
84
|
+
|
|
85
|
+
```yaml
|
|
86
|
+
---
|
|
87
|
+
src: ./slides/intro.md # Import markdown file
|
|
88
|
+
---
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
With specific slides:
|
|
92
|
+
|
|
93
|
+
```yaml
|
|
94
|
+
---
|
|
95
|
+
src: ./other.md#2,5-7 # Import slides 2, 5, 6, 7
|
|
96
|
+
---
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
## Route Alias
|
|
100
|
+
|
|
101
|
+
```yaml
|
|
102
|
+
---
|
|
103
|
+
routeAlias: intro # URL: /intro instead of /1
|
|
104
|
+
---
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
## Preload
|
|
108
|
+
|
|
109
|
+
```yaml
|
|
110
|
+
---
|
|
111
|
+
preload: false # Don't mount until entering
|
|
112
|
+
---
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
## Draggable Positions
|
|
116
|
+
|
|
117
|
+
```yaml
|
|
118
|
+
---
|
|
119
|
+
dragPos:
|
|
120
|
+
logo: 100,50,200,100,0 # Left,Top,Width,Height,Rotate
|
|
121
|
+
arrow: 300,200,50,50,45
|
|
122
|
+
---
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
## Image Layouts
|
|
126
|
+
|
|
127
|
+
```yaml
|
|
128
|
+
---
|
|
129
|
+
layout: image-left
|
|
130
|
+
image: /photo.jpg
|
|
131
|
+
backgroundSize: contain
|
|
132
|
+
class: my-custom-class
|
|
133
|
+
---
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
## Iframe Layouts
|
|
137
|
+
|
|
138
|
+
```yaml
|
|
139
|
+
---
|
|
140
|
+
layout: iframe
|
|
141
|
+
url: https://example.com
|
|
142
|
+
---
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
## Two Columns
|
|
146
|
+
|
|
147
|
+
```yaml
|
|
148
|
+
---
|
|
149
|
+
layout: two-cols
|
|
150
|
+
---
|
|
151
|
+
|
|
152
|
+
# Left Side
|
|
153
|
+
|
|
154
|
+
Content
|
|
155
|
+
|
|
156
|
+
::right::
|
|
157
|
+
|
|
158
|
+
# Right Side
|
|
159
|
+
|
|
160
|
+
Content
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
## Two Columns with Header
|
|
164
|
+
|
|
165
|
+
```yaml
|
|
166
|
+
---
|
|
167
|
+
layout: two-cols-header
|
|
168
|
+
---
|
|
169
|
+
|
|
170
|
+
# Header
|
|
171
|
+
|
|
172
|
+
::left::
|
|
173
|
+
|
|
174
|
+
Left content
|
|
175
|
+
|
|
176
|
+
::right::
|
|
177
|
+
|
|
178
|
+
Right content
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
## Full Example
|
|
182
|
+
|
|
183
|
+
```yaml
|
|
184
|
+
---
|
|
185
|
+
layout: center
|
|
186
|
+
background: /bg.jpg
|
|
187
|
+
class: text-white text-center
|
|
188
|
+
transition: fade
|
|
189
|
+
clicks: 3
|
|
190
|
+
zoom: 0.9
|
|
191
|
+
hideInToc: false
|
|
192
|
+
---
|
|
193
|
+
|
|
194
|
+
# Slide Content
|
|
195
|
+
```
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: global-context
|
|
3
|
+
description: Access navigation, slide info, and configuration programmatically
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Global Context & API
|
|
7
|
+
|
|
8
|
+
Access navigation, slide info, and configuration programmatically.
|
|
9
|
+
|
|
10
|
+
## Template Variables
|
|
11
|
+
|
|
12
|
+
Available in slides and components:
|
|
13
|
+
|
|
14
|
+
```md
|
|
15
|
+
Page {{ $page }} of {{ $nav.total }}
|
|
16
|
+
Title: {{ $slidev.configs.title }}
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
### $nav
|
|
20
|
+
|
|
21
|
+
Navigation state and controls:
|
|
22
|
+
|
|
23
|
+
| Property | Type | Description |
|
|
24
|
+
|----------|------|-------------|
|
|
25
|
+
| `$nav.currentPage` | number | Current page (1-indexed) |
|
|
26
|
+
| `$nav.currentLayout` | string | Current layout name |
|
|
27
|
+
| `$nav.total` | number | Total slides |
|
|
28
|
+
| `$nav.isPresenter` | boolean | In presenter mode |
|
|
29
|
+
| `$nav.next()` | function | Next click/slide |
|
|
30
|
+
| `$nav.prev()` | function | Previous click/slide |
|
|
31
|
+
| `$nav.nextSlide()` | function | Next slide |
|
|
32
|
+
| `$nav.prevSlide()` | function | Previous slide |
|
|
33
|
+
| `$nav.go(n)` | function | Go to slide n |
|
|
34
|
+
|
|
35
|
+
### $slidev
|
|
36
|
+
|
|
37
|
+
Global context:
|
|
38
|
+
|
|
39
|
+
| Property | Description |
|
|
40
|
+
|----------|-------------|
|
|
41
|
+
| `$slidev.configs` | Project config (title, etc.) |
|
|
42
|
+
| `$slidev.themeConfigs` | Theme config |
|
|
43
|
+
|
|
44
|
+
### $frontmatter
|
|
45
|
+
|
|
46
|
+
Current slide frontmatter:
|
|
47
|
+
|
|
48
|
+
```md
|
|
49
|
+
Layout: {{ $frontmatter.layout }}
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### $clicks
|
|
53
|
+
|
|
54
|
+
Current click count on slide.
|
|
55
|
+
|
|
56
|
+
### $page
|
|
57
|
+
|
|
58
|
+
Current page number (1-indexed).
|
|
59
|
+
|
|
60
|
+
### $renderContext
|
|
61
|
+
|
|
62
|
+
Current render context:
|
|
63
|
+
- `'slide'` - Normal slide view
|
|
64
|
+
- `'overview'` - Overview mode
|
|
65
|
+
- `'presenter'` - Presenter mode
|
|
66
|
+
- `'previewNext'` - Next slide preview
|
|
67
|
+
|
|
68
|
+
## Composables
|
|
69
|
+
|
|
70
|
+
Import from `@slidev/client`:
|
|
71
|
+
|
|
72
|
+
```ts
|
|
73
|
+
import {
|
|
74
|
+
useNav,
|
|
75
|
+
useDarkMode,
|
|
76
|
+
useIsSlideActive,
|
|
77
|
+
useSlideContext,
|
|
78
|
+
onSlideEnter,
|
|
79
|
+
onSlideLeave,
|
|
80
|
+
} from '@slidev/client'
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
### useNav
|
|
84
|
+
|
|
85
|
+
```ts
|
|
86
|
+
const nav = useNav()
|
|
87
|
+
nav.next()
|
|
88
|
+
nav.go(5)
|
|
89
|
+
console.log(nav.currentPage)
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### useDarkMode
|
|
93
|
+
|
|
94
|
+
```ts
|
|
95
|
+
const { isDark, toggle } = useDarkMode()
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### useIsSlideActive
|
|
99
|
+
|
|
100
|
+
```ts
|
|
101
|
+
const isActive = useIsSlideActive()
|
|
102
|
+
// Returns ref<boolean>
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
### useSlideContext
|
|
106
|
+
|
|
107
|
+
```ts
|
|
108
|
+
const { $page, $clicks, $frontmatter } = useSlideContext()
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
## Lifecycle Hooks
|
|
112
|
+
|
|
113
|
+
```ts
|
|
114
|
+
import { onSlideEnter, onSlideLeave } from '@slidev/client'
|
|
115
|
+
|
|
116
|
+
onSlideEnter(() => {
|
|
117
|
+
// Slide became active
|
|
118
|
+
startAnimation()
|
|
119
|
+
})
|
|
120
|
+
|
|
121
|
+
onSlideLeave(() => {
|
|
122
|
+
// Slide became inactive
|
|
123
|
+
cleanup()
|
|
124
|
+
})
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
**Important:** Don't use `onMounted`/`onUnmounted` in slides - component instance persists. Use `onSlideEnter`/`onSlideLeave` instead.
|
|
128
|
+
|
|
129
|
+
## Conditional Rendering Examples
|
|
130
|
+
|
|
131
|
+
```html
|
|
132
|
+
<!-- Show only in presenter mode -->
|
|
133
|
+
<div v-if="$nav.isPresenter">
|
|
134
|
+
Presenter notes
|
|
135
|
+
</div>
|
|
136
|
+
|
|
137
|
+
<!-- Hide on cover slide -->
|
|
138
|
+
<footer v-if="$nav.currentLayout !== 'cover'">
|
|
139
|
+
Page {{ $nav.currentPage }}
|
|
140
|
+
</footer>
|
|
141
|
+
|
|
142
|
+
<!-- Different content by context -->
|
|
143
|
+
<template v-if="$renderContext === 'slide'">
|
|
144
|
+
Normal view
|
|
145
|
+
</template>
|
|
146
|
+
<template v-else-if="$renderContext === 'presenter'">
|
|
147
|
+
Presenter view
|
|
148
|
+
</template>
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
## Type Imports
|
|
152
|
+
|
|
153
|
+
```ts
|
|
154
|
+
import type { TocItem } from '@slidev/types'
|
|
155
|
+
```
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: headmatter
|
|
3
|
+
description: Deck-wide configuration options in the first frontmatter block
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Headmatter Configuration
|
|
7
|
+
|
|
8
|
+
Deck-wide configuration options in the first frontmatter block.
|
|
9
|
+
|
|
10
|
+
## Theme & Appearance
|
|
11
|
+
|
|
12
|
+
```yaml
|
|
13
|
+
---
|
|
14
|
+
theme: default # Theme package or path
|
|
15
|
+
colorSchema: auto # 'auto' | 'light' | 'dark'
|
|
16
|
+
favicon: /favicon.ico # Favicon URL
|
|
17
|
+
aspectRatio: 16/9 # Slide aspect ratio
|
|
18
|
+
canvasWidth: 980 # Canvas width in px
|
|
19
|
+
---
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Fonts
|
|
23
|
+
|
|
24
|
+
```yaml
|
|
25
|
+
---
|
|
26
|
+
fonts:
|
|
27
|
+
sans: Roboto
|
|
28
|
+
serif: Roboto Slab
|
|
29
|
+
mono: Fira Code
|
|
30
|
+
provider: google # 'google' | 'none'
|
|
31
|
+
---
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Code & Highlighting
|
|
35
|
+
|
|
36
|
+
```yaml
|
|
37
|
+
---
|
|
38
|
+
highlighter: shiki # Code highlighter
|
|
39
|
+
lineNumbers: false # Show line numbers
|
|
40
|
+
monaco: true # Enable Monaco editor ('true' | 'dev' | 'build')
|
|
41
|
+
twoslash: true # Enable TwoSlash
|
|
42
|
+
monacoTypesSource: local # 'local' | 'cdn' | 'none'
|
|
43
|
+
---
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Features
|
|
47
|
+
|
|
48
|
+
```yaml
|
|
49
|
+
---
|
|
50
|
+
drawings:
|
|
51
|
+
enabled: true # Enable drawing mode
|
|
52
|
+
persist: false # Save drawings
|
|
53
|
+
presenterOnly: false # Only presenter can draw
|
|
54
|
+
syncAll: true # Sync across instances
|
|
55
|
+
record: dev # Enable recording
|
|
56
|
+
selectable: true # Text selection
|
|
57
|
+
contextMenu: true # Right-click menu
|
|
58
|
+
wakeLock: true # Prevent screen sleep
|
|
59
|
+
---
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## Export & Build
|
|
63
|
+
|
|
64
|
+
```yaml
|
|
65
|
+
---
|
|
66
|
+
download: false # PDF download button
|
|
67
|
+
exportFilename: slides # Export filename
|
|
68
|
+
export:
|
|
69
|
+
format: pdf
|
|
70
|
+
timeout: 30000
|
|
71
|
+
withClicks: false
|
|
72
|
+
withToc: false
|
|
73
|
+
---
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## Info & SEO
|
|
77
|
+
|
|
78
|
+
```yaml
|
|
79
|
+
---
|
|
80
|
+
title: My Presentation
|
|
81
|
+
titleTemplate: '%s - Slidev'
|
|
82
|
+
author: Your Name
|
|
83
|
+
keywords: slidev, presentation
|
|
84
|
+
info: |
|
|
85
|
+
## About
|
|
86
|
+
Presentation description
|
|
87
|
+
---
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
## SEO Meta Tags
|
|
91
|
+
|
|
92
|
+
```yaml
|
|
93
|
+
---
|
|
94
|
+
seoMeta:
|
|
95
|
+
ogTitle: Presentation Title
|
|
96
|
+
ogDescription: Description
|
|
97
|
+
ogImage: https://example.com/og.png
|
|
98
|
+
ogUrl: https://example.com
|
|
99
|
+
twitterCard: summary_large_image
|
|
100
|
+
twitterTitle: Title
|
|
101
|
+
twitterDescription: Description
|
|
102
|
+
twitterImage: https://example.com/twitter.png
|
|
103
|
+
---
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
## Addons & Themes
|
|
107
|
+
|
|
108
|
+
```yaml
|
|
109
|
+
---
|
|
110
|
+
theme: seriph
|
|
111
|
+
addons:
|
|
112
|
+
- excalidraw
|
|
113
|
+
- '@slidev/plugin-notes'
|
|
114
|
+
---
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
## Theme Configuration
|
|
118
|
+
|
|
119
|
+
```yaml
|
|
120
|
+
---
|
|
121
|
+
themeConfig:
|
|
122
|
+
primary: '#5d8392'
|
|
123
|
+
# Theme-specific options
|
|
124
|
+
---
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
## Defaults
|
|
128
|
+
|
|
129
|
+
Set default frontmatter for all slides:
|
|
130
|
+
|
|
131
|
+
```yaml
|
|
132
|
+
---
|
|
133
|
+
defaults:
|
|
134
|
+
layout: default
|
|
135
|
+
transition: fade
|
|
136
|
+
---
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
## HTML Attributes
|
|
140
|
+
|
|
141
|
+
```yaml
|
|
142
|
+
---
|
|
143
|
+
htmlAttrs:
|
|
144
|
+
dir: ltr
|
|
145
|
+
lang: en
|
|
146
|
+
---
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
## Presenter & Browser
|
|
150
|
+
|
|
151
|
+
```yaml
|
|
152
|
+
---
|
|
153
|
+
presenter: true # 'true' | 'dev' | 'build'
|
|
154
|
+
browserExporter: dev # 'true' | 'dev' | 'build'
|
|
155
|
+
routerMode: history # 'history' | 'hash'
|
|
156
|
+
---
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
## Remote Assets
|
|
160
|
+
|
|
161
|
+
```yaml
|
|
162
|
+
---
|
|
163
|
+
remoteAssets: false # Download remote assets locally
|
|
164
|
+
plantUmlServer: https://www.plantuml.com/plantuml
|
|
165
|
+
---
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
## Full Template
|
|
169
|
+
|
|
170
|
+
```yaml
|
|
171
|
+
---
|
|
172
|
+
theme: default
|
|
173
|
+
title: Presentation Title
|
|
174
|
+
author: Your Name
|
|
175
|
+
highlighter: shiki
|
|
176
|
+
lineNumbers: true
|
|
177
|
+
transition: slide-left
|
|
178
|
+
aspectRatio: 16/9
|
|
179
|
+
canvasWidth: 980
|
|
180
|
+
fonts:
|
|
181
|
+
sans: Roboto
|
|
182
|
+
mono: Fira Code
|
|
183
|
+
drawings:
|
|
184
|
+
enabled: true
|
|
185
|
+
persist: true
|
|
186
|
+
download: true
|
|
187
|
+
---
|
|
188
|
+
```
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: hosting
|
|
3
|
+
description: Build and deploy Slidev presentations
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Hosting & Deployment
|
|
7
|
+
|
|
8
|
+
Build and deploy Slidev presentations.
|
|
9
|
+
|
|
10
|
+
## Build for Production
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
slidev build
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
Output: `dist/` folder (static SPA)
|
|
17
|
+
|
|
18
|
+
### Options
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
slidev build --base /talks/my-talk/ # Custom base path
|
|
22
|
+
slidev build --out public # Custom output dir
|
|
23
|
+
slidev build --download # Include PDF
|
|
24
|
+
slidev build --without-notes # Exclude notes
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
### Multiple Presentations
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
slidev build slides1.md slides2.md
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## GitHub Pages
|
|
34
|
+
|
|
35
|
+
### GitHub Actions
|
|
36
|
+
|
|
37
|
+
Create `.github/workflows/deploy.yml`:
|
|
38
|
+
|
|
39
|
+
```yaml
|
|
40
|
+
name: Deploy
|
|
41
|
+
|
|
42
|
+
on:
|
|
43
|
+
push:
|
|
44
|
+
branches: [main]
|
|
45
|
+
|
|
46
|
+
permissions:
|
|
47
|
+
contents: read
|
|
48
|
+
pages: write
|
|
49
|
+
id-token: write
|
|
50
|
+
|
|
51
|
+
jobs:
|
|
52
|
+
deploy:
|
|
53
|
+
runs-on: ubuntu-latest
|
|
54
|
+
steps:
|
|
55
|
+
- uses: actions/checkout@v4
|
|
56
|
+
|
|
57
|
+
- uses: actions/setup-node@v4
|
|
58
|
+
with:
|
|
59
|
+
node-version: 'lts/*'
|
|
60
|
+
|
|
61
|
+
- name: Install
|
|
62
|
+
run: npm install
|
|
63
|
+
|
|
64
|
+
- name: Build
|
|
65
|
+
run: npm run build -- --base /${{ github.event.repository.name }}/
|
|
66
|
+
|
|
67
|
+
- uses: actions/configure-pages@v4
|
|
68
|
+
|
|
69
|
+
- uses: actions/upload-pages-artifact@v3
|
|
70
|
+
with:
|
|
71
|
+
path: dist
|
|
72
|
+
|
|
73
|
+
- uses: actions/deploy-pages@v4
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## Netlify
|
|
77
|
+
|
|
78
|
+
Create `netlify.toml`:
|
|
79
|
+
|
|
80
|
+
```toml
|
|
81
|
+
[build]
|
|
82
|
+
publish = 'dist'
|
|
83
|
+
command = 'npm run build'
|
|
84
|
+
|
|
85
|
+
[[redirects]]
|
|
86
|
+
from = '/*'
|
|
87
|
+
to = '/index.html'
|
|
88
|
+
status = 200
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
## Vercel
|
|
92
|
+
|
|
93
|
+
Create `vercel.json`:
|
|
94
|
+
|
|
95
|
+
```json
|
|
96
|
+
{
|
|
97
|
+
"rewrites": [
|
|
98
|
+
{ "source": "/(.*)", "destination": "/index.html" }
|
|
99
|
+
]
|
|
100
|
+
}
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
## Docker
|
|
104
|
+
|
|
105
|
+
### Using Official Image
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
docker run --name slidev --rm -it \
|
|
109
|
+
-v ${PWD}:/slidev \
|
|
110
|
+
-p 3030:3030 \
|
|
111
|
+
tangramor/slidev:latest
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
### Custom Dockerfile
|
|
115
|
+
|
|
116
|
+
```dockerfile
|
|
117
|
+
FROM tangramor/slidev:latest
|
|
118
|
+
|
|
119
|
+
COPY slides.md .
|
|
120
|
+
COPY public ./public
|
|
121
|
+
|
|
122
|
+
RUN npm run build
|
|
123
|
+
|
|
124
|
+
EXPOSE 80
|
|
125
|
+
CMD ["npx", "serve", "dist"]
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
## Base Path
|
|
129
|
+
|
|
130
|
+
For subdirectory deployment:
|
|
131
|
+
|
|
132
|
+
```bash
|
|
133
|
+
# Build
|
|
134
|
+
slidev build --base /my-slides/
|
|
135
|
+
|
|
136
|
+
# Or in headmatter
|
|
137
|
+
---
|
|
138
|
+
base: /my-slides/
|
|
139
|
+
---
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
## Router Mode
|
|
143
|
+
|
|
144
|
+
For servers without rewrite support:
|
|
145
|
+
|
|
146
|
+
```yaml
|
|
147
|
+
---
|
|
148
|
+
routerMode: hash
|
|
149
|
+
---
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
URLs become: `/#/1`, `/#/2`, etc.
|