@slidev/docs 51.6.2

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.
Files changed (81) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +39 -0
  3. package/builtin/cli.md +96 -0
  4. package/builtin/components.md +359 -0
  5. package/builtin/layouts.md +217 -0
  6. package/custom/config-code-runners.md +78 -0
  7. package/custom/config-context-menu.md +40 -0
  8. package/custom/config-fonts.md +105 -0
  9. package/custom/config-highlighter.md +74 -0
  10. package/custom/config-katex.md +18 -0
  11. package/custom/config-mermaid.md +47 -0
  12. package/custom/config-monaco.md +99 -0
  13. package/custom/config-parser.md +232 -0
  14. package/custom/config-routes.md +28 -0
  15. package/custom/config-shortcuts.md +36 -0
  16. package/custom/config-transformers.md +43 -0
  17. package/custom/config-unocss.md +46 -0
  18. package/custom/config-vite.md +83 -0
  19. package/custom/config-vue.md +25 -0
  20. package/custom/directory-structure.md +134 -0
  21. package/custom/index.md +192 -0
  22. package/features/block-frontmatter.md +39 -0
  23. package/features/build-with-pdf.md +42 -0
  24. package/features/bundle-remote-assets.md +29 -0
  25. package/features/canvas-size.md +32 -0
  26. package/features/click-marker.md +31 -0
  27. package/features/code-block-line-numbers.md +32 -0
  28. package/features/code-block-max-height.md +32 -0
  29. package/features/direction-variant.md +31 -0
  30. package/features/draggable.md +82 -0
  31. package/features/drawing.md +74 -0
  32. package/features/eject-theme.md +27 -0
  33. package/features/frontmatter-merging.md +49 -0
  34. package/features/global-layers.md +99 -0
  35. package/features/icons.md +58 -0
  36. package/features/import-snippet.md +48 -0
  37. package/features/importing-slides.md +69 -0
  38. package/features/index.md +93 -0
  39. package/features/latex.md +80 -0
  40. package/features/line-highlighting.md +57 -0
  41. package/features/mdc.md +31 -0
  42. package/features/mermaid.md +37 -0
  43. package/features/monaco-editor.md +36 -0
  44. package/features/monaco-run.md +44 -0
  45. package/features/monaco-write.md +22 -0
  46. package/features/plantuml.md +26 -0
  47. package/features/prettier-plugin.md +55 -0
  48. package/features/recording.md +28 -0
  49. package/features/remote-access.md +69 -0
  50. package/features/rough-marker.md +46 -0
  51. package/features/shiki-magic-move.md +53 -0
  52. package/features/side-editor.md +17 -0
  53. package/features/slide-hook.md +33 -0
  54. package/features/slide-scope-style.md +44 -0
  55. package/features/slot-sugar.md +83 -0
  56. package/features/transform-component.md +29 -0
  57. package/features/twoslash.md +37 -0
  58. package/features/vscode-extension.md +80 -0
  59. package/features/zoom-slide.md +33 -0
  60. package/guide/animations.md +456 -0
  61. package/guide/component.md +36 -0
  62. package/guide/exporting.md +240 -0
  63. package/guide/faq.md +134 -0
  64. package/guide/global-context.md +169 -0
  65. package/guide/hosting.md +220 -0
  66. package/guide/index.md +161 -0
  67. package/guide/layout.md +32 -0
  68. package/guide/syntax.md +179 -0
  69. package/guide/theme-addon.md +62 -0
  70. package/guide/ui.md +86 -0
  71. package/guide/why.md +112 -0
  72. package/guide/write-addon.md +48 -0
  73. package/guide/write-layout.md +45 -0
  74. package/guide/write-theme.md +109 -0
  75. package/index.md +6 -0
  76. package/package.json +47 -0
  77. package/resources/addon-gallery.md +32 -0
  78. package/resources/covers.md +16 -0
  79. package/resources/learning.md +22 -0
  80. package/resources/showcases.md +10 -0
  81. package/resources/theme-gallery.md +32 -0
@@ -0,0 +1,192 @@
1
+ # Customizations
2
+
3
+ Slidev is fully customizable, from styling to tooling configurations. It allows you to configure the tools underneath ([Vite](/custom/config-vite), [UnoCSS](/custom/config-unocss), [Monaco](/custom/config-monaco), etc.)
4
+
5
+ ## Slides Deck Configs {#headmatter}
6
+
7
+ You can configure the whole slides project in the frontmatter of your **first** slide (i.e. headmatter). The following shows the default value for each option:
8
+
9
+ ```yaml
10
+ ---
11
+ # theme id, package name, or local path
12
+ # Learn more: https://sli.dev/guide/theme-addon.html#use-theme
13
+ theme: default
14
+ # addons, can be a list of package names or local paths
15
+ # Learn more: https://sli.dev/guide/theme-addon.html#use-addon
16
+ addons: []
17
+ # title of your slide, will inferred from the first header if not specified
18
+ title: Slidev
19
+ # titleTemplate for the webpage, `%s` will be replaced by the slides deck's title
20
+ titleTemplate: '%s - Slidev'
21
+ # information for your slides, can be a Markdown string
22
+ info: false
23
+ # author field for exported PDF or PPTX
24
+ author: Your Name Here
25
+ # keywords field for exported PDF, comma-delimited
26
+ keywords: keyword1,keyword2
27
+
28
+ # enable presenter mode, can be boolean, 'dev' or 'build'
29
+ presenter: true
30
+ # enable browser exporter, can be boolean, 'dev' or 'build'
31
+ browserExporter: dev
32
+ # enabled pdf downloading in SPA build, can also be a custom url
33
+ download: false
34
+ # filename of the export file
35
+ exportFilename: slidev-exported
36
+ # export options
37
+ # use export CLI options in camelCase format
38
+ # Learn more: https://sli.dev/guide/exporting.html
39
+ export:
40
+ format: pdf
41
+ timeout: 30000
42
+ dark: false
43
+ withClicks: false
44
+ withToc: false
45
+ # enable twoslash, can be boolean, 'dev' or 'build'
46
+ twoslash: true
47
+ # show line numbers in code blocks
48
+ lineNumbers: false
49
+ # enable monaco editor, can be boolean, 'dev' or 'build'
50
+ monaco: true
51
+ # Where to load monaco types from, can be 'cdn', 'local' or 'none'
52
+ monacoTypesSource: local
53
+ # explicitly specify extra local packages to import the types for
54
+ monacoTypesAdditionalPackages: []
55
+ # explicitly specify extra local modules as dependencies of monaco runnable
56
+ monacoRunAdditionalDeps: []
57
+ # download remote assets in local using vite-plugin-remote-assets, can be boolean, 'dev' or 'build'
58
+ remoteAssets: false
59
+ # controls whether texts in slides are selectable
60
+ selectable: true
61
+ # enable slide recording, can be boolean, 'dev' or 'build'
62
+ record: dev
63
+ # enable Slidev's context menu, can be boolean, 'dev' or 'build'
64
+ contextMenu: true
65
+ # enable wake lock, can be boolean, 'dev' or 'build'
66
+ wakeLock: true
67
+ # take snapshot for each slide in the overview
68
+ overviewSnapshots: false
69
+
70
+ # force color schema for the slides, can be 'auto', 'light', or 'dark'
71
+ colorSchema: auto
72
+ # router mode for vue-router, can be "history" or "hash"
73
+ routerMode: history
74
+ # aspect ratio for the slides
75
+ aspectRatio: 16/9
76
+ # real width of the canvas, unit in px
77
+ canvasWidth: 980
78
+ # used for theme customization, will inject root styles as `--slidev-theme-x` for attribute `x`
79
+ themeConfig:
80
+ primary: '#5d8392'
81
+
82
+ # favicon, can be a local file path or URL
83
+ favicon: 'https://cdn.jsdelivr.net/gh/slidevjs/slidev/assets/favicon.png'
84
+ # URL of PlantUML server used to render diagrams
85
+ # Learn more: https://sli.dev/features/plantuml.html
86
+ plantUmlServer: https://www.plantuml.com/plantuml
87
+ # fonts will be auto-imported from Google fonts
88
+ # Learn more: https://sli.dev/custom/config-fonts.html
89
+ fonts:
90
+ sans: Roboto
91
+ serif: Roboto Slab
92
+ mono: Fira Code
93
+
94
+ # default frontmatter applies to all slides
95
+ defaults:
96
+ layout: default
97
+ # ...
98
+
99
+ # drawing options
100
+ # Learn more: https://sli.dev/guide/drawing.html
101
+ drawings:
102
+ enabled: true
103
+ persist: false
104
+ presenterOnly: false
105
+ syncAll: true
106
+
107
+ # HTML tag attributes
108
+ htmlAttrs:
109
+ dir: ltr
110
+ lang: en
111
+
112
+ # SEO meta tags
113
+ seoMeta:
114
+ ogTitle: Slidev Starter Template
115
+ ogDescription: Presentation slides for developers
116
+ ogImage: https://cover.sli.dev
117
+ ogUrl: https://example.com
118
+ twitterCard: summary_large_image
119
+ twitterTitle: Slidev Starter Template
120
+ twitterDescription: Presentation slides for developers
121
+ twitterImage: https://cover.sli.dev
122
+ twitterSite: username
123
+ twitterUrl: https://example.com
124
+ ---
125
+ ```
126
+
127
+ Check out the [type definitions](https://github.com/slidevjs/slidev/blob/main/packages/types/src/config.ts) for more details.
128
+
129
+ ## Per-slide Configs {#frontmatter}
130
+
131
+ Also every slide accepts the following configuration in its frontmatter block. The following shows the default value for each option:
132
+
133
+ ```yaml
134
+ ---
135
+ # custom clicks count
136
+ # Learn more: https://sli.dev/guide/animations.html#custom-total-clicks-count
137
+ clicks: 0
138
+ # custom start clicks count
139
+ clicksStart: 0
140
+ # completely disable and hide the slide
141
+ disabled: false
142
+ # the same as `disabled`
143
+ hide: false
144
+ # hide the slide for the <Toc> components
145
+ hideInToc: false
146
+ # defines the layout component applied to the slide
147
+ layout: <"cover" if the slide is the first slide, otherwise "default">
148
+ # override the title level for the <TitleRenderer> and <Toc> components
149
+ # only if `title` has also been declared
150
+ level: 1
151
+ # mount this slide before entering
152
+ preload: true
153
+ # create a route alias that can be used in the URL or with the <Link> component
154
+ routeAlias: undefined # or string
155
+ # includes a markdown file
156
+ # Learn more: https://sli.dev/guide/syntax.html#importing-slides
157
+ src: undefined # or string
158
+ # override the title for the <TitleRenderer> and <Toc> components
159
+ # only if `title` has also been declared
160
+ title: undefined # or string
161
+ # defines the transition between the slide and the next one
162
+ # Learn more: https://sli.dev/guide/animations.html#slide-transitions
163
+ transition: undefined # or BuiltinSlideTransition | string | TransitionGroupProps | null
164
+ # custom zoom scale
165
+ # useful for slides with a lot of content
166
+ zoom: 1
167
+ # used as positions of draggable elements
168
+ # Learn more: https://sli.dev/features/draggable.html
169
+ dragPos: {} # type: Record<string, string>
170
+ ---
171
+ ```
172
+
173
+ Check out the [type definition](https://github.com/slidevjs/slidev/blob/main/packages/types/src/frontmatter.ts#L260) for more details.
174
+
175
+ ## Directory Structure
176
+
177
+ Slidev uses directory structure conventions to minimalize the configuration surface and make extensions in functionality flexible and intuitive.
178
+
179
+ Refer to the [Directory Structure](/custom/directory-structure) section.
180
+
181
+ ## Config Tools
182
+
183
+ <script setup>
184
+ import VPLink from 'vitepress/dist/client/theme-default/components/VPLink.vue'
185
+ import customizations from '../.vitepress/customizations'
186
+ </script>
187
+
188
+ <li v-for="c of customizations.slice(2)" :key="c.text">
189
+ <VPLink :href="c.link">
190
+ {{ c.text }}
191
+ </VPLink>
192
+ </li>
@@ -0,0 +1,39 @@
1
+ ---
2
+ depends:
3
+ - guide/syntax
4
+ relates:
5
+ - features/prettier-plugin
6
+ tags: [syntax]
7
+ description: |
8
+ Use a YAML code block as the frontmatter.
9
+ ---
10
+
11
+ # Block Frontmatter
12
+
13
+ The usual way to define frontmatters of slides is concise, but may lack of highlighting and formatter support. To solve this, you can use a YAML block at the very beginning of the slide content as the frontmatter of the slide:
14
+
15
+ ````md
16
+ ---
17
+ theme: default
18
+ ---
19
+
20
+ # Slide 1
21
+
22
+ ---
23
+
24
+ ```yaml
25
+ layout: quote
26
+ ```
27
+
28
+ # Slide 2
29
+
30
+ ---
31
+
32
+ # Slide 3
33
+ ````
34
+
35
+ ::: warning About headmatter
36
+
37
+ Headmatter in Slidev is exactly the usual called "frontmatter" of the a Markdown file, which is supported by most of the Markdown editors and formatters. So you can't use a YAML block as the headmatter of the whole slide deck.
38
+
39
+ :::
@@ -0,0 +1,42 @@
1
+ ---
2
+ depends:
3
+ - guide/exporting
4
+ - guide/hosting
5
+ relates:
6
+ - CLI export options: /builtin/cli#export
7
+ - Headmatter export options: /custom/#headmatter
8
+ tags: [export, build]
9
+ description: |
10
+ Generate a downloadable PDF along with your slides build.
11
+ ---
12
+
13
+ # Generate PDF when Building
14
+
15
+ You can provide a downloadable PDF in your built slides with the following config in headmatter:
16
+
17
+ ```md
18
+ ---
19
+ download: true
20
+ ---
21
+ ```
22
+
23
+ Slidev will generate a PDF file along with the build, and a download button will be displayed in the build.
24
+
25
+ You can also provide a custom URL for the PDF. In that case, the rendering process will be skipped.
26
+
27
+ ```md
28
+ ---
29
+ download: 'https://myside.com/my-talk.pdf'
30
+ ---
31
+ ```
32
+
33
+ This can also be done with the CLI option `--download` (`boolean` only).
34
+
35
+ ```bash
36
+ $ slidev build --download
37
+ ```
38
+
39
+ When using the download option, you can also provide the export options via:
40
+
41
+ - [CLI export options](/builtin/cli#export)
42
+ - [Headmatter export options](/custom/#frontmatter-configures)
@@ -0,0 +1,29 @@
1
+ ---
2
+ relates:
3
+ - vite-plugin-remote-assets: https://github.com/antfu/vite-plugin-remote-assets
4
+ tags: [build]
5
+ description: |
6
+ Download and bundle remote assets when building your slides.
7
+ ---
8
+
9
+ # Bundle Remote Assets
10
+
11
+ Just like you would do in markdown, you can use images pointing to a remote or local URL.
12
+
13
+ For remote assets, the built-in [`vite-plugin-remote-assets`](https://github.com/antfu/vite-plugin-remote-assets) will cache them onto the disk at first run, ensuring instant loading even for large images later on.
14
+
15
+ ```md
16
+ ![Remote Image](https://sli.dev/favicon.png)
17
+ ```
18
+
19
+ For local assets, put them into the [`public` folder](/custom/directory-structure.html#public) and reference them with a **leading slash** (i.e., `/pic.png`, NOT `./pic.png`, which is relative to the working file).
20
+
21
+ ```md
22
+ ![Local Image](/pic.png)
23
+ ```
24
+
25
+ If you want to apply custom sizes or styles, you can convert them to the `<img>` tag:
26
+
27
+ ```html
28
+ <img src="/pic.png" class="m-40 h-40 rounded shadow" />
29
+ ```
@@ -0,0 +1,32 @@
1
+ ---
2
+ relates:
3
+ - guide/faq#adjust-size
4
+ - features/zoom-slide
5
+ - features/transform-component
6
+ tags: [layout]
7
+ description: |
8
+ Set the size for all your slides.
9
+ ---
10
+
11
+ # Slide Canvas Size
12
+
13
+ Slidev allows you to set the size of the slide canvas via the `canvasWidth` and `aspectRatio` options in the headmatter:
14
+
15
+ ```md
16
+ ---
17
+ # aspect ratio for the slides
18
+ aspectRatio: 16/9
19
+ # real width of the canvas, unit in px
20
+ canvasWidth: 980
21
+ ---
22
+
23
+ # Your slides here
24
+ ```
25
+
26
+ To scale several slides in your presentation, you can use the `zoom` option:
27
+
28
+ <LinkCard link="features/zoom-slide" />
29
+
30
+ To adjust the size of some elements on your slides, you can use the `Transform` component:
31
+
32
+ <LinkCard link="features/transform-component" />
@@ -0,0 +1,31 @@
1
+ ---
2
+ depends:
3
+ - guide/syntax#notes
4
+ - guide/animations
5
+ since: v0.48.0
6
+ tags: [presenter, animation]
7
+ description: |
8
+ Highlighting notes and auto-scrolling to the active section of notes.
9
+ ---
10
+
11
+ # Click Markers
12
+
13
+ For some slides you may have longer notes that could be hard to find your place. Slidev supports click markers that allow highlighting and auto-scrolling to the section of notes from your corresponding content. Put `[click]` markers at the beginning of any line in your notes for the timing you need to go to another [click](/guide/animations#click-animation). You may skip `n` clicks by using `[click:{n+1}]`. For example:
14
+
15
+ ```md
16
+ <!--
17
+ Content before the first click
18
+
19
+ [click] This will be highlighted after the first click
20
+
21
+ Also highlighted after the first click
22
+
23
+ - [click] This list element will be highlighted after the second click
24
+
25
+ [click:3] Last click (skip two clicks)
26
+ -->
27
+ ```
28
+
29
+ Slidev divides the content between the click markers and highlights it in presenter notes, synchronized with your slide progress.
30
+
31
+ <video src="https://github.com/slidevjs/slidev/assets/11247099/40014e34-67cd-4830-8c8d-8431754a3672" controls rounded shadow w-full></video>
@@ -0,0 +1,32 @@
1
+ ---
2
+ depends:
3
+ - guide/syntax#code-block
4
+ tags: [codeblock]
5
+ description: |
6
+ Enable line numbering for all code blocks across the slides or individually.
7
+ ---
8
+
9
+ # Line Numbers
10
+
11
+ You can enable line numbering for all code blocks across the slides by setting `lineNumbers: true` in the headmatter, or enable each code block individually by setting `lines: true`.
12
+
13
+ You can also set the starting line for each code block and highlight the lines accordingly via `{startLine: number}`, which defaults to 1.
14
+
15
+ ````md
16
+ ```ts {6,7}{lines:true,startLine:5}
17
+ function add(
18
+ a: Ref<number> | number,
19
+ b: Ref<number> | number
20
+ ) {
21
+ return computed(() => unref(a) + unref(b))
22
+ }
23
+ ```
24
+ ````
25
+
26
+ Note that you can use `{*}` as a placeholder of <LinkInline link="features/line-highlighting" />:
27
+
28
+ ````md
29
+ ```ts {*}{lines:true,startLine:5}
30
+ // ...
31
+ ```
32
+ ````
@@ -0,0 +1,32 @@
1
+ ---
2
+ depends:
3
+ - guide/syntax#code-block
4
+ tags: [codeblock, layout]
5
+ description: |
6
+ Set a maximum height for a code block and enable scrolling.
7
+ ---
8
+
9
+ # Max Height
10
+
11
+ If the code doesn't fit into one slide, you use the `maxHeight` to set a fixed height and enable scrolling:
12
+
13
+ ````md
14
+ ```ts {2|3|7|12}{maxHeight:'100px'}
15
+ function add(
16
+ a: Ref<number> | number,
17
+ b: Ref<number> | number
18
+ ) {
19
+ return computed(() => unref(a) + unref(b))
20
+ }
21
+ /// ...as many lines as you want
22
+ const c = add(1, 2)
23
+ ```
24
+ ````
25
+
26
+ Note that you can use `{*}` as a placeholder of <LinkInline link="features/line-highlighting" />:
27
+
28
+ ````md
29
+ ```ts {*}{maxHeight:'100px'}
30
+ // ...
31
+ ```
32
+ ````
@@ -0,0 +1,31 @@
1
+ ---
2
+ relates:
3
+ - UnoCSS Variants: https://unocss.dev/config/variants#variants
4
+ since: v0.48.0
5
+ tags: [navigation, styling]
6
+ description: |
7
+ Apply different styles and animations based on the navigation direction.
8
+ ---
9
+
10
+ # Navigation Direction Variants
11
+
12
+ You may want to apply different classes based on whether it's navigating forward or backward. The `.slidev-nav-go-forward` or `.slidev-nav-go-backward` class will be applied to the slide container when navigating, and you can use them to apply different styles or animations:
13
+
14
+ ```css
15
+ /* example: delay on only forward but not backward */
16
+ .slidev-nav-go-forward .slidev-vclick-target {
17
+ transition-delay: 500ms;
18
+ }
19
+ .slidev-nav-go-backward .slidev-vclick-target {
20
+ transition-delay: 0;
21
+ }
22
+ ```
23
+
24
+ To make it easier, we also provided some [UnoCSS variants](https://github.com/slidevjs/slidev/blob/6adcf2016b8fb0cab65cf150221f1f67a76a2dd8/packages/client/uno.config.ts#L32-L38) for this. You can use the `forward:` or `backward:` prefix to any UnoCSS classes to only enable them in the specific navigation direction:
25
+
26
+ ```html
27
+ <div v-click class="transition delay-300">Element</div> // [!code --]
28
+ <div v-click class="transition forward:delay-300">Element</div> // [!code ++]
29
+ ```
30
+
31
+ In the above example, the animation is only delayed when navigating forward.
@@ -0,0 +1,82 @@
1
+ ---
2
+ tags: [layout]
3
+ description: |
4
+ Move, resize, and rotate elements by dragging them with the mouse.
5
+ ---
6
+
7
+ # Draggable Elements
8
+
9
+ Draggable elements give you the ability to move, resize, and rotate elements by dragging them with the mouse. This is useful for creating floating elements in your slides.
10
+
11
+ ## Directive Usage
12
+
13
+ ### Data from the frontmatter
14
+
15
+ ```md
16
+ ---
17
+ dragPos:
18
+ square: Left,Top,Width,Height,Rotate
19
+ ---
20
+
21
+ <img v-drag="'square'" src="https://sli.dev/logo.png">
22
+ ```
23
+
24
+ ### Data from the directive value
25
+
26
+ ::: warning
27
+ Slidev use regex to update the position value in the slide content. If you meet problems, please use the frontmatter to define the values instead.
28
+ :::
29
+
30
+ ```md
31
+ <img v-drag="[Left,Top,Width,Height,Rotate]" src="https://sli.dev/logo.png">
32
+ ```
33
+
34
+ ## Component Usage
35
+
36
+ ### Data from the frontmatter
37
+
38
+ ```md
39
+ ---
40
+ dragPos:
41
+ foo: Left,Top,Width,Height,Rotate
42
+ ---
43
+
44
+ <v-drag pos="foo" text-3xl>
45
+ <div class="i-carbon:arrow-up" />
46
+ Use the `v-drag` component to have a draggable container!
47
+ </v-drag>
48
+ ```
49
+
50
+ ### Data from props
51
+
52
+ ```md
53
+ <v-drag pos="Left,Top,Width,Height,Rotate" text-3xl>
54
+ <div class="i-carbon:arrow-up" />
55
+ Use the `v-drag` component to have a draggable container!
56
+ </v-drag>
57
+ ```
58
+
59
+ ## Create a Draggable Element
60
+
61
+ When you create a new draggable element, you don't need to specify the position value (but you need to specify the position name if you want to use the frontmatter). Slidev will automatically generate the initial position value for you.
62
+
63
+ ## Automatic Height
64
+
65
+ You can set `Height` to `NaN` (in) or `_` (if you use the component) to make the height of the draggable element automatically adjust to its content.
66
+
67
+ ## Controls
68
+
69
+ - Double-click the draggable element to start dragging it.
70
+ - You can also use the arrow keys to move the element.
71
+ - Hold `Shift` while dragging to preserve its aspect ratio.
72
+ - Click outside the draggable element to stop dragging it.
73
+
74
+ ## Draggable Arrow
75
+
76
+ The `<v-drag-arrow>` component creates a draggable arrow element. Simply use it like this:
77
+
78
+ ```md
79
+ <v-drag-arrow />
80
+ ```
81
+
82
+ And you will get a draggable arrow element. Other props are the same as [the `Arrow` component](/builtin/components#arrow).
@@ -0,0 +1,74 @@
1
+ ---
2
+ depends:
3
+ - guide/ui#navigation-bar
4
+ relates:
5
+ - drauu: https://github.com/antfu/drauu
6
+ tags: [drawing]
7
+ description: |
8
+ Draw and annotate your slides with ease.
9
+ ---
10
+
11
+ # Drawing & Annotations
12
+
13
+ Slidev comes with a built-in drawing and annotation feature powered by [drauu](https://github.com/antfu/drauu). It allows you to draw and annotate your slides with ease.
14
+
15
+ To start, click the <carbon-pen class="inline-icon-btn"/> icon in the [navigation bar](../guide/ui#navigation-bar) to open the drawing toolbar. It's also available in the [Presenter Mode](/guide/ui#presenter-mode). Drawings and annotations you created will be **synced** automatically across all instances in real-time.
16
+
17
+ <TheTweet id="1424027510342250499" />
18
+
19
+ ## Use with Stylus Pen
20
+
21
+ When using a stylus pen on a tablet (for example, iPad with Apple Pencil), Slidev will intelligently detect the input type. You can directly draw on your slides with the pen without turning on the drawing mode while having your fingers or mouse control the navigation.
22
+
23
+ ## Persist Drawings
24
+
25
+ The following frontmatter configuration allows you to persist your drawings as SVGs under `.slidev/drawings` directory and have them inside your exported PDF or hosted site.
26
+
27
+ ```md
28
+ ---
29
+ drawings:
30
+ persist: true
31
+ ---
32
+ ```
33
+
34
+ ## Disable Drawings
35
+
36
+ Entirely:
37
+
38
+ ```md
39
+ ---
40
+ drawings:
41
+ enabled: false
42
+ ---
43
+ ```
44
+
45
+ Only in Development:
46
+
47
+ ```md
48
+ ---
49
+ drawings:
50
+ enabled: dev
51
+ ---
52
+ ```
53
+
54
+ Only in Presenter Mode:
55
+
56
+ ```md
57
+ ---
58
+ drawings:
59
+ presenterOnly: true
60
+ ---
61
+ ```
62
+
63
+ ## Drawing Syncing
64
+
65
+ By default, Slidev syncs up your drawings across all instances. If you are sharing your slides with others, you might want to disable the syncing via:
66
+
67
+ ```md
68
+ ---
69
+ drawings:
70
+ syncAll: false
71
+ ---
72
+ ```
73
+
74
+ With this config, only the drawing from the presenter instance will be able to sync with others.
@@ -0,0 +1,27 @@
1
+ ---
2
+ depends:
3
+ - guide/theme-addon
4
+ tags: [theme, cli]
5
+ description: |
6
+ Eject the installed theme from your project to customize it.
7
+ ---
8
+
9
+ # Eject Theme
10
+
11
+ If you want to get full control of the current theme, you can **eject** it to your local file system and modify it as you want. By running the following command
12
+
13
+ ```bash
14
+ $ slidev theme eject
15
+ ```
16
+
17
+ It will eject the theme you are using currently into `./theme`, and change your frontmatter to
18
+
19
+ ```yaml
20
+ ---
21
+ theme: ./theme
22
+ ---
23
+ ```
24
+
25
+ This could also be helpful if you want to make a theme based on an existing one. If you do, remember to mention the original theme and the author :)
26
+
27
+ For more options of the `theme` command, please refer to the [Theme Command](../builtin/cli#theme) section.