@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,44 @@
1
+ ---
2
+ depends:
3
+ - features/monaco-editor
4
+ - guide/animations
5
+ relates:
6
+ - Custom Code Runners: /custom/config-code-runners
7
+ since: v0.48.0
8
+ tags: [codeblock, editor]
9
+ description: |
10
+ Run code directly in the editor and see the result.
11
+ ---
12
+
13
+ # Monaco Runner
14
+
15
+ Slidev also provides the Monaco Runner Editor, which allows you to run the code directly in the editor and see the result. Use `{monaco-run}` to turn the block into a Monaco Runner Editor.
16
+
17
+ ````md
18
+ ```ts {monaco-run}
19
+ function distance(x: number, y: number) {
20
+ return Math.sqrt(x ** 2 + y ** 2)
21
+ }
22
+ console.log(distance(3, 4))
23
+ ```
24
+ ````
25
+
26
+ It provides the editor with a "Run" button, and shows the result of the code execution right below the code block. You may also modify the code and the result will be re-evaluated on the fly.
27
+
28
+ By default it will automatically run the code when the slide is loaded; if you want to instead explicitly trigger the run, you can set `{autorun:false}`.
29
+
30
+ ````md
31
+ ```ts {monaco-run} {autorun:false}
32
+ console.log('Click the play button to run me')
33
+ ```
34
+ ````
35
+
36
+ If you want to only show the output in certain clicks, you can use the `showOutputAt` prop. The value is the same as `v-click`.
37
+
38
+ ````md
39
+ ```ts {monaco-run} {showOutputAt:'+1'}
40
+ console.log('Shown after 1 click')
41
+ ```
42
+ ````
43
+
44
+ Currently, Slidev supports running JavaScript and TypeScript code out-of-box. Refer to [Custom Code Runners](/custom/config-code-runners) for custom language support.
@@ -0,0 +1,22 @@
1
+ ---
2
+ depends:
3
+ - features/monaco-editor
4
+ - features/import-snippet
5
+ relates:
6
+ - features/import-snippet
7
+ - Custom Code Runners: /custom/config-code-runners
8
+ since: v0.49.5
9
+ tags: [codeblock, editor]
10
+ description: |
11
+ A monaco editor that allows you to write code directly in the slides and save the changes back to the file.
12
+ ---
13
+
14
+ # Writable Monaco Editor
15
+
16
+ You can also use the [Import Code Snippets](#import-code-snippets) syntax combined with the `{monaco-write}` directive, to link your Monaco Editor with a file on your filesystem. This will allow you to edit the code directly in the editor and save the changes back to the file.
17
+
18
+ ```md
19
+ <<< ./some-file.ts {monaco-write}
20
+ ```
21
+
22
+ When using this, be sure to back up your files beforehand, as the changes will be saved directly to the file.
@@ -0,0 +1,26 @@
1
+ ---
2
+ relates:
3
+ - Plant UML: https://plantuml.com/
4
+ - Plant UML Live Editor: https://plantuml.com/plantuml
5
+ - Example side: https://sli.dev/demo/starter/12
6
+ - features/mermaid
7
+ tags: [diagram]
8
+ description: |
9
+ Create diagrams from textual descriptions, powered by PlantUML.
10
+ ---
11
+
12
+ # PlantUML Diagrams
13
+
14
+ You can create PlantUML diagrams easily in your slides, for example:
15
+
16
+ ````md
17
+ ```plantuml
18
+ @startuml
19
+ Alice -> Bob : Hello!
20
+ @enduml
21
+ ```
22
+ ````
23
+
24
+ The source code will be sent to https://www.plantuml.com/plantuml to render the diagram by default. You can also set up your own server by setting the `plantUmlServer` in the [Slidev configuration](../custom/index#headmatter).
25
+
26
+ Visit the [PlantUML Website](https://plantuml.com/) for more information.
@@ -0,0 +1,55 @@
1
+ ---
2
+ relates:
3
+ - features/block-frontmatter
4
+ - GitHub Repo: https://github.com/slidevjs/prettier-plugin
5
+ - Prettier: https://prettier.io/
6
+ tags: [editor]
7
+ description: |
8
+ Use the Prettier plugin to format your slides.
9
+ ---
10
+
11
+ # Prettier Plugin
12
+
13
+ The Slidev's syntax may be incompatible with the default Markdown parser of [Prettier](https://prettier.io/). To solve this, Slidev provides a Prettier plugin to format your slides. You can use it with your favorite editor that supports Prettier.
14
+
15
+ ## 1. Install
16
+
17
+ ::: code-group
18
+
19
+ ```bash [npm]
20
+ npm i -D prettier prettier-plugin-slidev
21
+ ```
22
+
23
+ ```bash [pnpm]
24
+ pnpm i -D prettier prettier-plugin-slidev
25
+ ```
26
+
27
+ ```bash [yarn]
28
+ yarn add -D prettier prettier-plugin-slidev
29
+ ```
30
+
31
+ ```bash [bun]
32
+ bun add -D prettier prettier-plugin-slidev
33
+ ```
34
+
35
+ :::
36
+
37
+ ## 2. Activate the plugin
38
+
39
+ Create or modify your [prettier configuration file](https://prettier.io/docs/en/configuration) to activate the plugin:
40
+
41
+ ```json
42
+ {
43
+ "overrides": [
44
+ {
45
+ "files": ["slides.md", "pages/*.md"],
46
+ "options": {
47
+ "parser": "slidev",
48
+ "plugins": ["prettier-plugin-slidev"]
49
+ }
50
+ }
51
+ ]
52
+ }
53
+ ```
54
+
55
+ Note that only specifying `plugins` is not enough, because Slidev and common Markdown files share the same file extension `.md`.
@@ -0,0 +1,28 @@
1
+ ---
2
+ depends:
3
+ - guide/ui#navigation-bar
4
+ relates:
5
+ - RecordRTC: https://github.com/muaz-khan/RecordRTC
6
+ - WebRTC API: https://webrtc.org/
7
+ tags: [presenter, tool]
8
+ description: |
9
+ Record your presentation with the built-in camera view and recording feature.
10
+ ---
11
+
12
+ # Recording
13
+
14
+ Slidev comes with a built-in camera view and recording feature. They make it simple for you to record your presentation without having to switch between other recording tools while delivering a presentation.
15
+
16
+ ## Camera View {#camera-view}
17
+
18
+ Click the <carbon-user-avatar class="inline-icon-btn"/> button in the [navigation bar](../guide/ui#navigation-bar) to show your camera view in the presentation. You can drag it to move it, and use the handler on the right bottom corner to resize it. The size and position will persist across reloads.
19
+
20
+ <TheTweet id="1395006771027120133" />
21
+
22
+ ## Start Recording {#start-recording}
23
+
24
+ Clicking the <carbon-video class="inline-icon-btn"/> button in the [navigation bar](../guide/ui#navigation-bar) will bring up a dialog for you. Here you can choose to either record your camera output embedded in your slides or to separate them into two video files.
25
+
26
+ This feature is powered by [RecordRTC](https://github.com/muaz-khan/RecordRTC) and uses the [WebRTC API](https://webrtc.org/).
27
+
28
+ ![](/screenshots/recording.png)
@@ -0,0 +1,69 @@
1
+ ---
2
+ relates:
3
+ - guide/ui
4
+ - CLI: builtin/cli
5
+ - Cloudflare Quick Tunnels: https://developers.cloudflare.com/cloudflare-one/connections/connect-networks/do-more-with-tunnels/trycloudflare/
6
+ tags: [remote, tool]
7
+ description: |
8
+ Access your presentation remotely with Slidev's remote access feature.
9
+ ---
10
+
11
+ # Remote Access
12
+
13
+ You can run your presentation with remote access by using the `--remote` flag:
14
+
15
+ ::: code-group
16
+
17
+ ```bash [pnpm]
18
+ pnpm dev --remote
19
+ # i.e. slidev --remote
20
+ ```
21
+
22
+ ```bash [npm]
23
+ npm run dev -- --remote
24
+ # i.e. slidev --remote
25
+ ```
26
+
27
+ ```bash [yarn]
28
+ yarn dev --remote
29
+ # i.e. slidev --remote
30
+ ```
31
+
32
+ ```bash [bun]
33
+ bun dev --remote
34
+ # i.e. slidev --remote
35
+ ```
36
+
37
+ :::
38
+
39
+ ## Password Protection
40
+
41
+ If you want to share your slides but don't want other people to access the presenter mode, you can pass a password to the option, i.e. `--remote=your_password`. Then the password is required when accessing the presenter mode.
42
+
43
+ ## Remote Tunnel
44
+
45
+ You can open a [Cloudflare Quick Tunnels](https://developers.cloudflare.com/cloudflare-one/connections/connect-networks/do-more-with-tunnels/trycloudflare/) to expose your local server to the internet. This way, you can share your slides with others without setting up a server.
46
+
47
+ ::: code-group
48
+
49
+ ```bash [pnpm]
50
+ pnpm dev -- --remote --tunnel
51
+ # i.e. slidev --remote --tunnel
52
+ ```
53
+
54
+ ```bash [npm]
55
+ npm run dev -- --remote --tunnel
56
+ # i.e. slidev --remote --tunnel
57
+ ```
58
+
59
+ ```bash [yarn]
60
+ yarn dev --remote --tunnel
61
+ # i.e. slidev --remote --tunnel
62
+ ```
63
+
64
+ ```bash [bun]
65
+ bun dev --remote --tunnel
66
+ # i.e. slidev --remote --tunnel
67
+ ```
68
+
69
+ :::
@@ -0,0 +1,46 @@
1
+ ---
2
+ depends:
3
+ - guide/animations
4
+ relates:
5
+ - Rough Notation: https://github.com/linkstrifer/react-rough-notation
6
+ since: v0.48.0
7
+ tags: [drawing, animation]
8
+ description: |
9
+ Integrate Rough Notation to allow marking or highlighting elements in your slides.
10
+ ---
11
+
12
+ # Rough Markers
13
+
14
+ Slidev integrates [Rough Notation](https://github.com/linkstrifer/react-rough-notation) to allow marking or highlighting elements in your slides.
15
+
16
+ ---
17
+
18
+ ### `v-mark` directive
19
+
20
+ Rough Notation integrates comes with the `v-mark` directive.
21
+
22
+ #### Type
23
+
24
+ `v-mark.underline` for the underline mark, `v-mark.circle` for the circle mark, etc. Default to `underline`
25
+
26
+ #### Color
27
+
28
+ `v-mark.red` makes the notation `red`. Supported built-in color themes from UnoCSS. For custom colors, use object syntax `v-mark="{ color: '#234' }"`
29
+
30
+ #### Clicks
31
+
32
+ `v-mark` works like `v-click` and will trigger after a click. Same as `v-click`, it allows you to pass a custom click value, like `v-mark="5"` or `v-mark="'+1'"`.
33
+
34
+ #### Options
35
+
36
+ Optionally you can pass an object to `v-mark` to specify the options, for example:
37
+
38
+ ```vue
39
+ <span v-mark="{ at: 5, color: '#234', type: 'circle' }">
40
+ Important text
41
+ </span>
42
+ ```
43
+
44
+ #### Preview
45
+
46
+ <video src="https://github.com/slidevjs/slidev/assets/11247099/c840340c-0aa1-4cde-b228-e6c67e5f6879" rounded-lg shadow controls></video>
@@ -0,0 +1,53 @@
1
+ ---
2
+ depends:
3
+ - guide/syntax#code-block
4
+ - guide/animations
5
+ relates:
6
+ - Shiki Magic Move: https://github.com/shikijs/shiki-magic-move
7
+ since: v0.48.0
8
+ tags: [codeblock, animation]
9
+ description: |
10
+ Enable granular transition between code changes, similar to Keynote's Magic Move.
11
+ ---
12
+
13
+ # Shiki Magic Move
14
+
15
+ [Shiki Magic Move](https://github.com/shikijs/shiki-magic-move) enables you to have a granular transition between code changes, similar to Keynote's Magic Move. You can check [the playground](https://shiki-magic-move.netlify.app/) to see how it works.
16
+
17
+ <video src="https://github.com/slidevjs/slidev/assets/11247099/79927794-27ba-4342-9911-9996cec889d6" controls rounded shadow w-full></video>
18
+
19
+ In Slidev, we bind the magic-move to the [clicks system](/guide/animations#click-animation). The syntax is to wrap multiple code blocks representing each step with <code>````md magic-move</code> (mind it's **4** backticks), this will be transformed into one code block, that morphs to each step as you click.
20
+
21
+ `````md
22
+ ````md magic-move
23
+ ```js
24
+ console.log(`Step ${1}`)
25
+ ```
26
+ ```js
27
+ console.log(`Step ${1 + 1}`)
28
+ ```
29
+ ```ts
30
+ console.log(`Step ${3}` as string)
31
+ ```
32
+ ````
33
+ `````
34
+
35
+ It's also possible to mix Magic Move with <LinkInline link="features/line-highlighting" /> and <LinkInline link="features/code-block-line-numbers" />, for example:
36
+
37
+ `````md
38
+ ````md magic-move {at:4, lines: true} // [!code hl]
39
+ ```js {*|1|2-5} // [!code hl]
40
+ let count = 1
41
+ function add() {
42
+ count++
43
+ }
44
+ ```
45
+
46
+ Non-code blocks in between as ignored, you can put some comments.
47
+
48
+ ```js {*}{lines: false} // [!code hl]
49
+ let count = 1
50
+ const add = () => count += 1
51
+ ```
52
+ ````
53
+ `````
@@ -0,0 +1,17 @@
1
+ ---
2
+ depends:
3
+ - guide/ui#navigation-actions
4
+ relates:
5
+ - features/vscode-extension
6
+ tags: [editor]
7
+ description: |
8
+ Edit your slides source file alongside the presentation.
9
+ ---
10
+
11
+ # Integrated Editor
12
+
13
+ Slidev comes with an integrated editor that will instantly reload and save the changes to your file.
14
+
15
+ Click the <carbon-edit class="inline-icon-btn"/> button on the navigation panel to open it.
16
+
17
+ ![](/screenshots/integrated-editor.png)
@@ -0,0 +1,33 @@
1
+ ---
2
+ depends:
3
+ - guide/global-context
4
+ tags: [client-api]
5
+ description: |
6
+ Hooks to manage the slide lifecycle.
7
+ ---
8
+
9
+ # Slide Hooks
10
+
11
+ Slidev provides a set of hooks to help you manage the slide lifecycle:
12
+
13
+ ```ts twoslash
14
+ import { onSlideEnter, onSlideLeave, useIsSlideActive } from '@slidev/client'
15
+
16
+ const isActive = useIsSlideActive()
17
+
18
+ onSlideEnter(() => {
19
+ /* Called whenever the slide becomes active */
20
+ })
21
+
22
+ onSlideLeave(() => {
23
+ /* Called whenever the slide becomes inactive */
24
+ })
25
+ ```
26
+
27
+ You can also use <LinkInline link="guide/global-context" /> to access other useful context information.
28
+
29
+ ::: warning
30
+
31
+ In the slide component, `onMounted` and `onUnmounted` hooks are not available, because the component instance is preserved even when the slide is not active. Use `onSlideEnter` and `onSlideLeave` instead.
32
+
33
+ :::
@@ -0,0 +1,44 @@
1
+ ---
2
+ relates:
3
+ - Vue's Scoped CSS: https://vuejs.org/api/sfc-css-features.html#scoped-css
4
+ - UnoCSS directives: https://unocss.dev/transformers/directives
5
+ tags: [styling, syntax]
6
+ description: |
7
+ Define styles for only the current slide.
8
+ ---
9
+
10
+ # Slide Scope Styles
11
+
12
+ You can use the `<style>` tag in your Markdown to define styles for **only the current slide**.
13
+
14
+ ```md
15
+ # This is Red
16
+
17
+ <style>
18
+ h1 {
19
+ color: red;
20
+ }
21
+ </style>
22
+
23
+ ---
24
+
25
+ # Other slides are not affected
26
+ ```
27
+
28
+ The `<style>` tag in Markdown is always [scoped](https://vuejs.org/api/sfc-css-features.html#scoped-css). As a result, a selector with a child combinator (`.a > .b`) is unusable as such; see the previous link. To have global styles, check out the [customization section](/custom/directory-structure#style).
29
+
30
+ Powered by [UnoCSS](/custom/config-unocss), you can directly use nested css and [directives](https://unocss.dev/transformers/directives):
31
+
32
+ ```md
33
+ # Slidev
34
+
35
+ > Hello **world**
36
+
37
+ <style>
38
+ blockquote {
39
+ strong {
40
+ --uno: 'text-teal-500 dark:text-teal-400';
41
+ }
42
+ }
43
+ </style>
44
+ ```
@@ -0,0 +1,83 @@
1
+ ---
2
+ relates:
3
+ - Vue's Named Slots: https://v3.vuejs.org/guide/component-slots.html
4
+ tags: [layout, syntax]
5
+ description: |
6
+ A syntax sugar for named slots in layouts.
7
+ ---
8
+
9
+ # Slot Sugar for Layouts
10
+
11
+ Some layouts can provide multiple contributing points using [Vue's named slots](https://vuejs.org/guide/components/slots.html).
12
+
13
+ For example, in [`two-cols` layout](https://github.com/slidevjs/slidev/blob/main/packages/client/layouts/two-cols.vue), you can have two columns left (`default` slot) and right (`right` slot) side by side.
14
+
15
+ ```md
16
+ ---
17
+ layout: two-cols
18
+ ---
19
+
20
+ <template v-slot:default>
21
+
22
+ # Left
23
+
24
+ This is shown on the left
25
+
26
+ </template>
27
+ <template v-slot:right>
28
+
29
+ # Right
30
+
31
+ This is shown on the right
32
+
33
+ </template>
34
+ ```
35
+
36
+ <div class="grid grid-cols-2 rounded border border-gray-400 border-opacity-50 px-10 pb-4">
37
+ <div>
38
+ <h3>Left</h3>
39
+ <p>This shows on the left</p>
40
+ </div>
41
+ <div>
42
+ <h3>Right</h3>
43
+ <p>This shows on the right</p>
44
+ </div>
45
+ </div>
46
+
47
+ We also provide a shorthand syntactical sugar `::name::` for slot name. The following works exactly the same as the previous example.
48
+
49
+ ```md
50
+ ---
51
+ layout: two-cols
52
+ ---
53
+
54
+ # Left
55
+
56
+ This is shown on the left
57
+
58
+ ::right::
59
+
60
+ # Right
61
+
62
+ This is shown on the right
63
+ ```
64
+
65
+ You can also explicitly specify the default slot and provide it in the custom order.
66
+
67
+ ```md
68
+ ---
69
+ layout: two-cols
70
+ ---
71
+
72
+ ::right::
73
+
74
+ # Right
75
+
76
+ This shows on the right
77
+
78
+ ::default::
79
+
80
+ # Left
81
+
82
+ This is shown on the left
83
+ ```
@@ -0,0 +1,29 @@
1
+ ---
2
+ relates:
3
+ - guide/faq#adjust-size
4
+ - features/canvas-size
5
+ - features/zoom-slide
6
+ tags: [layout]
7
+ description: |
8
+ A component for scaling some elements.
9
+ ---
10
+
11
+ # The `Transform` Component
12
+
13
+ The `Transform` component allows you to scale the size of the elements on your slides:
14
+
15
+ ```md
16
+ <Transform :scale="0.5">
17
+ <YourElements />
18
+ </Transform>
19
+ ```
20
+
21
+ This is useful when you want to adjust the size of some elements on your slides without affecting the layout of the entire slide.
22
+
23
+ To scale all the slides in your presentation, you can set the slide canvas size:
24
+
25
+ <LinkCard link="features/canvas-size" />
26
+
27
+ To scale several slides in your presentation, you can use the `zoom` option:
28
+
29
+ <LinkCard link="features/zoom-slide" />
@@ -0,0 +1,37 @@
1
+ ---
2
+ depends:
3
+ - guide/syntax#code-block
4
+ relates:
5
+ - TwoSlash: https://twoslash.netlify.app/
6
+ since: v0.46.0
7
+ tags: [codeblock]
8
+ description: |
9
+ A powerful tool for rendering TypeScript code blocks with type information on hover or inlined.
10
+ ---
11
+
12
+ # TwoSlash Integration
13
+
14
+ [TwoSlash](https://twoslash.netlify.app/) is a powerful tool for rendering TypeScript code blocks with type information on hover or inlined. It's quite useful for preparing slides for JavaScript/TypeScript-related topics.
15
+
16
+ To use it, you can add `twoslash` to the code block's language identifier:
17
+
18
+ ````md
19
+ ```ts twoslash
20
+ import { ref } from 'vue'
21
+
22
+ const count = ref(0)
23
+ // ^?
24
+ ```
25
+ ````
26
+
27
+ It will be rendered as:
28
+
29
+ ```ts twoslash
30
+ import { ref } from 'vue'
31
+
32
+ const count = ref(0)
33
+ // ^?
34
+ ```
35
+
36
+ <!-- For the popup to not overlap the content below -->
37
+ <div class="py-20" />
@@ -0,0 +1,80 @@
1
+ ---
2
+ relates:
3
+ - VS Code: https://code.visualstudio.com/
4
+ - View in Marketplace: https://marketplace.visualstudio.com/items?itemName=antfu.slidev
5
+ - View in OVSX: https://open-vsx.org/extension/antfu/slidev
6
+ tags: [editor]
7
+ description: |
8
+ Help you better organize your slides and have a quick overview of them.
9
+ ---
10
+
11
+ # VS Code Extension
12
+
13
+ <p align="center">
14
+ <a href="https://github.com/slidevjs/slidev" target="_blank">
15
+ <img src="https://cdn.jsdelivr.net/gh/slidevjs/slidev/assets/logo-for-vscode.png" alt="Slidev" width="300" />
16
+ </a>
17
+ </p>
18
+
19
+ <a href="https://marketplace.visualstudio.com/items?itemName=antfu.slidev" target="__blank">
20
+ <img inline src="https://img.shields.io/visual-studio-marketplace/v/antfu.slidev.svg?color=4EC5D4&amp;label=VS%20Code%20Marketplace&logo=visual-studio-code" alt="Visual Studio Marketplace Version" />
21
+ </a> &nbsp;
22
+ <a href="https://marketplace.visualstudio.com/items?itemName=antfu.slidev" target="__blank">
23
+ <img inline src="https://img.shields.io/visual-studio-marketplace/d/antfu.slidev.svg?color=2B90B6" alt="Visual Studio Marketplace Downloads" />
24
+ </a>
25
+
26
+ The VS Code extension provides some features to help you better organize your slides and have a quick overview of them.
27
+
28
+ ### Features
29
+
30
+ - Preview slides in the side panel
31
+ - Slides tree view
32
+ - Re-ordering slides
33
+ - Folding for slide blocks
34
+ - Multiple slides project support
35
+ - Start the dev server with one click
36
+
37
+ ![](https://github.com/slidevjs/slidev/assets/63178754/2c9ba01a-d21f-4b33-b6b6-4e249873f865)
38
+
39
+ <TheTweet id="1395333405345148930" />
40
+
41
+ <TheTweet id="1789684139152810151" />
42
+
43
+ ### Installation
44
+
45
+ You can install the extension from the [VS Code Marketplace](https://marketplace.visualstudio.com/items?itemName=antfu.slidev) or the [Open VSX Registry](https://open-vsx.org/extension/antfu/slidev).
46
+
47
+ ### Usage
48
+
49
+ Click the `Slidev` icon in the activity bar to open the **Slidev panel**. In the Slidev panel, you can see the projects tree view, slides tree view, and the preview webview.
50
+
51
+ In the **projects tree view**, you can see all the Slidev projects in your workspace. You can click the item to open the corresponding file, and click the <codicon-eye /> icon over it to switch the active project. The <codicon-add /> icon allows you to load a slides project that wasn't scanned automatically.
52
+
53
+ In the **slides tree view**, you can see all the slides in the active project. You can click the item to move your cursor to the slide in the editor, and drag and drop to reorder the slides.
54
+
55
+ In the **preview webview**, you can click the <codicon-run-all /> icon to start the dev server and click the <codicon-globe /> icon to open the slides in the browser. Toggle <codicon-lock /> icon to sync/unsync the preview navigation with the editor cursor.
56
+
57
+ There are also some **commands** you can use. Type `Slidev` in the command palette to see them.
58
+
59
+ You can add glob patterns to the `slidev.include` configuration to include files as Slidev entries. The default value is `["**/*.md"]`. Example:
60
+
61
+ ```json
62
+ {
63
+ "slidev.include": ["**/presentation.md"]
64
+ }
65
+ ```
66
+
67
+ #### Dev Command {#dev-command}
68
+
69
+ You can customize the command to start dev server by setting the `slidev.dev-command` configuration. The default value is `npm exec -c 'slidev ${args}'`.
70
+
71
+ The configured command can contain placeholders:
72
+
73
+ - `${args}`: All CLI arguments. e.g. `slides.md --port 3000 --remote`
74
+ - `${port}`: The port number. e.g. `3000`
75
+
76
+ Examples:
77
+
78
+ - Global installation: `slidev ${args}`
79
+ - For PNPM users, you can set it to `pnpm slidev ${args}`.
80
+ - For [code-server](https://coder.com/docs/code-server/) users, you can set it to `pnpm slidev ${args} --base /proxy/${port}/`. This will make the dev server accessible at `http://localhost:8080/proxy/3000/`.