返回 slidev
core-exporting.md
根目录 / skills / slidev / references / core-exporting.md
1 ---
2 name: exporting
3 description: Export presentations to PDF, PPTX, PNG, or Markdown
4 ---
5
6 # Exporting Slides
7
8 Export presentations to PDF, PPTX, PNG, or Markdown.
9
10 ## Browser Exporter
11
12 Access at `http://localhost:3030/export`:
13 - Select format and options
14 - Preview and download
15
16 ## CLI Export
17
18 Requires playwright:
19 ```bash
20 pnpm add -D playwright-chromium
21 ```
22
23 ### PDF Export
24
25 ```bash
26 slidev export
27 slidev export --output my-slides.pdf
28 ```
29
30 ### PowerPoint Export
31
32 ```bash
33 slidev export --format pptx # each slide as an image
34 slidev export --format pptx-editable # native shapes, selectable text
35 ```
36
37 `pptx-editable` measures the rendered slides and rebuilds them as PowerPoint shapes. SVG (including Mermaid), canvas, iframes, KaTeX formulas, gradients and CSS filters stay pictures, and any slide that cannot be rebuilt falls back to the image export on its own. Fonts are named, not embedded. `--per-slide` is not supported with it.
38
39 ### PNG Export
40
41 ```bash
42 slidev export --format png
43 slidev export --format png --range 1-5
44 ```
45
46 ### Markdown Export
47
48 ```bash
49 slidev export --format md
50 ```
51
52 ## Export Options
53
54 ### With Click Steps
55
56 Export each click as separate page:
57 ```bash
58 slidev export --with-clicks
59 ```
60
61 ### Dark Mode
62
63 ```bash
64 slidev export --dark
65 ```
66
67 ### Slide Range
68
69 ```bash
70 slidev export --range 1,4-7,10
71 ```
72
73 ### Table of Contents
74
75 PDF with clickable outline:
76 ```bash
77 slidev export --with-toc
78 ```
79
80 ### Timeout
81
82 For slow-rendering slides:
83 ```bash
84 slidev export --timeout 60000
85 ```
86
87 ### Wait
88
89 Wait before capture:
90 ```bash
91 slidev export --wait 2000
92 ```
93
94 ### Wait Until
95
96 Wait condition:
97 ```bash
98 slidev export --wait-until networkidle # Default
99 slidev export --wait-until domcontentloaded
100 slidev export --wait-until load
101 slidev export --wait-until none
102 ```
103
104 ### Transparent Background
105
106 ```bash
107 slidev export --omit-background
108 ```
109
110 ### Custom Browser
111
112 ```bash
113 slidev export --executable-path /path/to/chrome
114 ```
115
116 ## Headmatter Options
117
118 ```yaml
119 ---
120 exportFilename: my-presentation
121 download: true # Add download button in build
122 export:
123 format: pdf
124 timeout: 30000
125 withClicks: false
126 ---
127 ```
128
129 ## Troubleshooting
130
131 ### Missing Content
132
133 Increase wait time:
134 ```bash
135 slidev export --wait 3000 --timeout 60000
136 ```
137
138 ### Wrong Global Layer State
139
140 Use `--per-slide` or use `slide-top.vue` instead of `global-top.vue`.
141
142 ### Broken Emojis
143
144 Use system fonts or install emoji font on server.
145
146 ### CI/CD Export
147
148 Install playwright browsers:
149 ```bash
150 npx playwright install chromium
151 ```
152
152 lines MARKDOWN