@slidev/cli 52.11.3 → 52.11.5
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-CBdhBv4d.mjs → build-DnSiH_hX.mjs} +1 -1
- package/dist/cli.mjs +3 -6
- package/dist/index.mjs +2 -2
- package/dist/{serve-jpCd8QH_.mjs → serve-imvXJyRN.mjs} +1 -1
- package/dist/{shared-Ba3UGXDn.mjs → shared-DHY1ulq4.mjs} +1 -1
- package/package.json +17 -16
- 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,68 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: drawing
|
|
3
|
+
description: Draw and annotate slides during presentation
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Drawing & Annotations
|
|
7
|
+
|
|
8
|
+
Draw and annotate slides during presentation. Powered by drauu.
|
|
9
|
+
|
|
10
|
+
## Enable Drawing
|
|
11
|
+
|
|
12
|
+
Click the pen icon in the navigation bar or press `C`.
|
|
13
|
+
|
|
14
|
+
## Stylus Support
|
|
15
|
+
|
|
16
|
+
Stylus pens (iPad + Apple Pencil) work automatically - draw with pen, navigate with fingers.
|
|
17
|
+
|
|
18
|
+
## Persist Drawings
|
|
19
|
+
|
|
20
|
+
Save drawings as SVGs and include in exports:
|
|
21
|
+
|
|
22
|
+
```md
|
|
23
|
+
---
|
|
24
|
+
drawings:
|
|
25
|
+
persist: true
|
|
26
|
+
---
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Drawings saved to `.slidev/drawings/`.
|
|
30
|
+
|
|
31
|
+
## Disable Drawing
|
|
32
|
+
|
|
33
|
+
Entirely:
|
|
34
|
+
```md
|
|
35
|
+
---
|
|
36
|
+
drawings:
|
|
37
|
+
enabled: false
|
|
38
|
+
---
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Only in development:
|
|
42
|
+
```md
|
|
43
|
+
---
|
|
44
|
+
drawings:
|
|
45
|
+
enabled: dev
|
|
46
|
+
---
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Only in presenter mode:
|
|
50
|
+
```md
|
|
51
|
+
---
|
|
52
|
+
drawings:
|
|
53
|
+
presenterOnly: true
|
|
54
|
+
---
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## Sync Settings
|
|
58
|
+
|
|
59
|
+
Disable sync across instances:
|
|
60
|
+
|
|
61
|
+
```md
|
|
62
|
+
---
|
|
63
|
+
drawings:
|
|
64
|
+
syncAll: false
|
|
65
|
+
---
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
Only presenter's drawings sync to others.
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: rough-marker
|
|
3
|
+
description: Hand-drawn style highlighting using Rough Notation
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Rough Markers
|
|
7
|
+
|
|
8
|
+
Hand-drawn style highlighting using Rough Notation.
|
|
9
|
+
|
|
10
|
+
## v-mark Directive
|
|
11
|
+
|
|
12
|
+
```html
|
|
13
|
+
<span v-mark>Important text</span>
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Marker Types
|
|
17
|
+
|
|
18
|
+
```html
|
|
19
|
+
<span v-mark.underline>Underlined</span>
|
|
20
|
+
<span v-mark.circle>Circled</span>
|
|
21
|
+
<span v-mark.highlight>Highlighted</span>
|
|
22
|
+
<span v-mark.strike-through>Struck through</span>
|
|
23
|
+
<span v-mark.box>Boxed</span>
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Colors
|
|
27
|
+
|
|
28
|
+
```html
|
|
29
|
+
<span v-mark.red>Red marker</span>
|
|
30
|
+
<span v-mark.blue>Blue marker</span>
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Custom color:
|
|
34
|
+
```html
|
|
35
|
+
<span v-mark="{ color: '#234' }">Custom color</span>
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Click Timing
|
|
39
|
+
|
|
40
|
+
Works like v-click:
|
|
41
|
+
|
|
42
|
+
```html
|
|
43
|
+
<span v-mark="5">Appears on click 5</span>
|
|
44
|
+
<span v-mark="'+1'">Next click</span>
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Full Options
|
|
48
|
+
|
|
49
|
+
```html
|
|
50
|
+
<span v-mark="{ at: 5, color: '#234', type: 'circle' }">
|
|
51
|
+
Custom marker
|
|
52
|
+
</span>
|
|
53
|
+
```
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: slide-hooks
|
|
3
|
+
description: Lifecycle hooks for slide components
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Slide Hooks
|
|
7
|
+
|
|
8
|
+
Lifecycle hooks for slide components.
|
|
9
|
+
|
|
10
|
+
## Available Hooks
|
|
11
|
+
|
|
12
|
+
```ts
|
|
13
|
+
import { onSlideEnter, onSlideLeave, useIsSlideActive } from '@slidev/client'
|
|
14
|
+
|
|
15
|
+
const isActive = useIsSlideActive()
|
|
16
|
+
|
|
17
|
+
onSlideEnter(() => {
|
|
18
|
+
// Called when slide becomes active
|
|
19
|
+
})
|
|
20
|
+
|
|
21
|
+
onSlideLeave(() => {
|
|
22
|
+
// Called when slide becomes inactive
|
|
23
|
+
})
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Important
|
|
27
|
+
|
|
28
|
+
Do NOT use `onMounted` / `onUnmounted` in slides - component instance persists even when slide is inactive.
|
|
29
|
+
|
|
30
|
+
Use `onSlideEnter` and `onSlideLeave` instead.
|
|
31
|
+
|
|
32
|
+
## Use Cases
|
|
33
|
+
|
|
34
|
+
- Start/stop animations
|
|
35
|
+
- Play/pause media
|
|
36
|
+
- Initialize/cleanup resources
|
|
37
|
+
- Track analytics
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: og-image
|
|
3
|
+
description: Configure Open Graph preview image for social sharing
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Open Graph Image
|
|
7
|
+
|
|
8
|
+
Set preview image for social media sharing.
|
|
9
|
+
|
|
10
|
+
## Custom URL
|
|
11
|
+
|
|
12
|
+
```md
|
|
13
|
+
---
|
|
14
|
+
seoMeta:
|
|
15
|
+
ogImage: https://url.to.your.image.png
|
|
16
|
+
---
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Local Image
|
|
20
|
+
|
|
21
|
+
Place `./og-image.png` in project root - Slidev uses it automatically.
|
|
22
|
+
|
|
23
|
+
## Auto-generate
|
|
24
|
+
|
|
25
|
+
Generate from first slide:
|
|
26
|
+
|
|
27
|
+
```md
|
|
28
|
+
---
|
|
29
|
+
seoMeta:
|
|
30
|
+
ogImage: auto
|
|
31
|
+
---
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Uses Playwright to capture first slide. Requires playwright to be installed.
|
|
35
|
+
|
|
36
|
+
Generated image saved as `./og-image.png` - can be committed to repo.
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: pdf
|
|
3
|
+
description: Include downloadable PDF in SPA build
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Generate PDF when Building
|
|
7
|
+
|
|
8
|
+
Generate a downloadable PDF alongside your built slides.
|
|
9
|
+
|
|
10
|
+
## Enable in Headmatter
|
|
11
|
+
|
|
12
|
+
```md
|
|
13
|
+
---
|
|
14
|
+
download: true
|
|
15
|
+
---
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
This generates a PDF and adds a download button to the built slides.
|
|
19
|
+
|
|
20
|
+
## Custom PDF URL
|
|
21
|
+
|
|
22
|
+
Skip generation and use an existing PDF:
|
|
23
|
+
|
|
24
|
+
```md
|
|
25
|
+
---
|
|
26
|
+
download: 'https://example.com/my-talk.pdf'
|
|
27
|
+
---
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## CLI Option
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
slidev build --download
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Export Options
|
|
37
|
+
|
|
38
|
+
Configure PDF export settings via:
|
|
39
|
+
- CLI: `slidev build --download --with-clicks --timeout 60000`
|
|
40
|
+
- Headmatter: Set `exportFilename`, `withClicks`, etc.
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: remote-assets
|
|
3
|
+
description: Bundle remote images and assets for offline use
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Bundle Remote Assets
|
|
7
|
+
|
|
8
|
+
Remote images are automatically cached on first run for faster loading.
|
|
9
|
+
|
|
10
|
+
## Remote Images
|
|
11
|
+
|
|
12
|
+
```md
|
|
13
|
+

|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
Cached automatically by vite-plugin-remote-assets.
|
|
17
|
+
|
|
18
|
+
## Local Images
|
|
19
|
+
|
|
20
|
+
Place in `public/` folder and reference with leading slash:
|
|
21
|
+
|
|
22
|
+
```md
|
|
23
|
+

|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Do NOT use relative paths like `./pic.png`.
|
|
27
|
+
|
|
28
|
+
## Custom Styling
|
|
29
|
+
|
|
30
|
+
Convert to img tag for custom sizes/styles:
|
|
31
|
+
|
|
32
|
+
```html
|
|
33
|
+
<img src="/pic.png" class="m-40 h-40 rounded shadow" />
|
|
34
|
+
```
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: seo-meta
|
|
3
|
+
description: Configure SEO and social media meta tags
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# SEO Meta Tags
|
|
7
|
+
|
|
8
|
+
Configure social media and search engine meta tags.
|
|
9
|
+
|
|
10
|
+
## Configuration
|
|
11
|
+
|
|
12
|
+
```yaml
|
|
13
|
+
---
|
|
14
|
+
seoMeta:
|
|
15
|
+
ogTitle: Slidev Starter Template
|
|
16
|
+
ogDescription: Presentation slides for developers
|
|
17
|
+
ogImage: https://cover.sli.dev
|
|
18
|
+
ogUrl: https://example.com
|
|
19
|
+
twitterCard: summary_large_image
|
|
20
|
+
twitterTitle: Slidev Starter Template
|
|
21
|
+
twitterDescription: Presentation slides for developers
|
|
22
|
+
twitterImage: https://cover.sli.dev
|
|
23
|
+
twitterSite: username
|
|
24
|
+
twitterUrl: https://example.com
|
|
25
|
+
---
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Available Options
|
|
29
|
+
|
|
30
|
+
**Open Graph (Facebook, LinkedIn):**
|
|
31
|
+
- `ogTitle` - Title
|
|
32
|
+
- `ogDescription` - Description
|
|
33
|
+
- `ogImage` - Preview image URL
|
|
34
|
+
- `ogUrl` - Canonical URL
|
|
35
|
+
|
|
36
|
+
**Twitter Card:**
|
|
37
|
+
- `twitterCard` - Card type (summary, summary_large_image)
|
|
38
|
+
- `twitterTitle` - Title
|
|
39
|
+
- `twitterDescription` - Description
|
|
40
|
+
- `twitterImage` - Preview image URL
|
|
41
|
+
- `twitterSite` - Twitter username
|
|
42
|
+
|
|
43
|
+
Powered by unhead.
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: code-groups
|
|
3
|
+
description: Group multiple code blocks with tabs and automatic icons
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Code Groups
|
|
7
|
+
|
|
8
|
+
Group multiple code blocks with tabs and automatic icons.
|
|
9
|
+
|
|
10
|
+
## Requirements
|
|
11
|
+
|
|
12
|
+
Enable MDC syntax in headmatter:
|
|
13
|
+
|
|
14
|
+
```md
|
|
15
|
+
---
|
|
16
|
+
mdc: true
|
|
17
|
+
---
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Syntax
|
|
21
|
+
|
|
22
|
+
````md
|
|
23
|
+
::code-group
|
|
24
|
+
|
|
25
|
+
```sh [npm]
|
|
26
|
+
npm i @slidev/cli
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
```sh [yarn]
|
|
30
|
+
yarn add @slidev/cli
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
```sh [pnpm]
|
|
34
|
+
pnpm add @slidev/cli
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
::
|
|
38
|
+
````
|
|
39
|
+
|
|
40
|
+
## Title Icon Matching
|
|
41
|
+
|
|
42
|
+
Icons auto-match by title name. Install `@iconify-json/vscode-icons` for built-in icons.
|
|
43
|
+
|
|
44
|
+
Supported: npm, yarn, pnpm, bun, deno, vue, react, typescript, javascript, and many more.
|
|
45
|
+
|
|
46
|
+
## Custom Icons
|
|
47
|
+
|
|
48
|
+
Use `~icon~` syntax in title:
|
|
49
|
+
|
|
50
|
+
````md
|
|
51
|
+
```js [npm ~i-uil:github~]
|
|
52
|
+
console.log('Hello!')
|
|
53
|
+
```
|
|
54
|
+
````
|
|
55
|
+
|
|
56
|
+
Requires:
|
|
57
|
+
1. Install icon collection: `pnpm add @iconify-json/uil`
|
|
58
|
+
2. Add to safelist in `uno.config.ts`:
|
|
59
|
+
|
|
60
|
+
```ts
|
|
61
|
+
export default defineConfig({
|
|
62
|
+
safelist: ['i-uil:github']
|
|
63
|
+
})
|
|
64
|
+
```
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: import-snippet
|
|
3
|
+
description: Import code from external files into slides with optional region selection
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Import Code Snippets
|
|
7
|
+
|
|
8
|
+
Import code from external files into slides.
|
|
9
|
+
|
|
10
|
+
## Basic Syntax
|
|
11
|
+
|
|
12
|
+
```md
|
|
13
|
+
<<< @/snippets/snippet.js
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
`@` = package root directory. Recommended: place snippets in `@/snippets/`.
|
|
17
|
+
|
|
18
|
+
## Import Region
|
|
19
|
+
|
|
20
|
+
Use VS Code region syntax:
|
|
21
|
+
|
|
22
|
+
```md
|
|
23
|
+
<<< @/snippets/snippet.js#region-name
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Specify Language
|
|
27
|
+
|
|
28
|
+
```md
|
|
29
|
+
<<< @/snippets/snippet.js ts
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## With Features
|
|
33
|
+
|
|
34
|
+
Combine with line highlighting, Monaco editor:
|
|
35
|
+
|
|
36
|
+
```md
|
|
37
|
+
<<< @/snippets/snippet.js {2,3|5}{lines:true}
|
|
38
|
+
<<< @/snippets/snippet.js ts {monaco}{height:200px}
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Placeholder
|
|
42
|
+
|
|
43
|
+
Use `{*}` for line highlighting placeholder:
|
|
44
|
+
|
|
45
|
+
```md
|
|
46
|
+
<<< @/snippets/snippet.js {*}{lines:true}
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Monaco Write
|
|
50
|
+
|
|
51
|
+
Link editor to file for live editing:
|
|
52
|
+
|
|
53
|
+
```md
|
|
54
|
+
<<< ./some-file.ts {monaco-write}
|
|
55
|
+
```
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: line-highlighting
|
|
3
|
+
description: Highlight specific lines in code blocks with static or click-based dynamic highlighting
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Line Highlighting
|
|
7
|
+
|
|
8
|
+
Highlight specific lines in code blocks.
|
|
9
|
+
|
|
10
|
+
## Static Highlighting
|
|
11
|
+
|
|
12
|
+
````md
|
|
13
|
+
```ts {2,3}
|
|
14
|
+
function add(
|
|
15
|
+
a: Ref<number> | number,
|
|
16
|
+
b: Ref<number> | number
|
|
17
|
+
) {
|
|
18
|
+
return computed(() => unref(a) + unref(b))
|
|
19
|
+
}
|
|
20
|
+
```
|
|
21
|
+
````
|
|
22
|
+
|
|
23
|
+
## Dynamic (Click-based)
|
|
24
|
+
|
|
25
|
+
Use `|` to separate stages:
|
|
26
|
+
|
|
27
|
+
````md
|
|
28
|
+
```ts {2-3|5|all}
|
|
29
|
+
function add(
|
|
30
|
+
a: Ref<number> | number,
|
|
31
|
+
b: Ref<number> | number
|
|
32
|
+
) {
|
|
33
|
+
return computed(() => unref(a) + unref(b))
|
|
34
|
+
}
|
|
35
|
+
```
|
|
36
|
+
````
|
|
37
|
+
|
|
38
|
+
Click progression: lines 2-3 → line 5 → all lines
|
|
39
|
+
|
|
40
|
+
## Special Values
|
|
41
|
+
|
|
42
|
+
- `hide` - Hide the code block
|
|
43
|
+
- `none` - Show code without highlighting
|
|
44
|
+
- `all` - Highlight all lines
|
|
45
|
+
|
|
46
|
+
````md
|
|
47
|
+
```ts {hide|none|all}
|
|
48
|
+
// Hidden → No highlight → All highlighted
|
|
49
|
+
```
|
|
50
|
+
````
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: line-numbers
|
|
3
|
+
description: Enable line numbering for code blocks globally or per-block
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Code Block Line Numbers
|
|
7
|
+
|
|
8
|
+
Enable line numbering for code blocks.
|
|
9
|
+
|
|
10
|
+
## Global Setting
|
|
11
|
+
|
|
12
|
+
Enable for all code blocks in headmatter:
|
|
13
|
+
|
|
14
|
+
```md
|
|
15
|
+
---
|
|
16
|
+
lineNumbers: true
|
|
17
|
+
---
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Per-Block Setting
|
|
21
|
+
|
|
22
|
+
````md
|
|
23
|
+
```ts {6,7}{lines:true,startLine:5}
|
|
24
|
+
function add(
|
|
25
|
+
a: Ref<number> | number,
|
|
26
|
+
b: Ref<number> | number
|
|
27
|
+
) {
|
|
28
|
+
return computed(() => unref(a) + unref(b))
|
|
29
|
+
}
|
|
30
|
+
```
|
|
31
|
+
````
|
|
32
|
+
|
|
33
|
+
## Options
|
|
34
|
+
|
|
35
|
+
- `lines: true/false` - Enable/disable line numbers
|
|
36
|
+
- `startLine: number` - Starting line number (default: 1)
|
|
37
|
+
|
|
38
|
+
## With Line Highlighting
|
|
39
|
+
|
|
40
|
+
Use `{*}` as placeholder when combining with other features:
|
|
41
|
+
|
|
42
|
+
````md
|
|
43
|
+
```ts {*}{lines:true,startLine:5}
|
|
44
|
+
// code here
|
|
45
|
+
```
|
|
46
|
+
````
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: magic-move
|
|
3
|
+
description: Animate code changes with smooth transitions between code blocks
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Shiki Magic Move
|
|
7
|
+
|
|
8
|
+
Animate code changes with smooth transitions (like Keynote's Magic Move).
|
|
9
|
+
|
|
10
|
+
## Basic Usage
|
|
11
|
+
|
|
12
|
+
`````md
|
|
13
|
+
````md magic-move
|
|
14
|
+
```js
|
|
15
|
+
console.log(`Step ${1}`)
|
|
16
|
+
```
|
|
17
|
+
```js
|
|
18
|
+
console.log(`Step ${1 + 1}`)
|
|
19
|
+
```
|
|
20
|
+
```ts
|
|
21
|
+
console.log(`Step ${3}` as string)
|
|
22
|
+
```
|
|
23
|
+
````
|
|
24
|
+
`````
|
|
25
|
+
|
|
26
|
+
Note: Use 4 backticks for the wrapper.
|
|
27
|
+
|
|
28
|
+
## With Line Highlighting
|
|
29
|
+
|
|
30
|
+
`````md
|
|
31
|
+
````md magic-move {at:4, lines: true}
|
|
32
|
+
```js {*|1|2-5}
|
|
33
|
+
let count = 1
|
|
34
|
+
function add() {
|
|
35
|
+
count++
|
|
36
|
+
}
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Non-code blocks in between are ignored.
|
|
40
|
+
|
|
41
|
+
```js {*}{lines: false}
|
|
42
|
+
let count = 1
|
|
43
|
+
const add = () => count += 1
|
|
44
|
+
```
|
|
45
|
+
````
|
|
46
|
+
`````
|
|
47
|
+
|
|
48
|
+
## How It Works
|
|
49
|
+
|
|
50
|
+
- Wraps multiple code blocks as one
|
|
51
|
+
- Each block is a "step"
|
|
52
|
+
- Morphs between steps on click
|
|
53
|
+
- Syntax highlighting preserved during animation
|
|
54
|
+
|
|
55
|
+
## Resources
|
|
56
|
+
|
|
57
|
+
- Playground: https://shiki-magic-move.netlify.app/
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: max-height
|
|
3
|
+
description: Set a fixed height for code blocks with scrolling for long code
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Code Block Max Height
|
|
7
|
+
|
|
8
|
+
Set a fixed height for code blocks with scrolling.
|
|
9
|
+
|
|
10
|
+
## Usage
|
|
11
|
+
|
|
12
|
+
````md
|
|
13
|
+
```ts {2|3|7|12}{maxHeight:'100px'}
|
|
14
|
+
function add(
|
|
15
|
+
a: Ref<number> | number,
|
|
16
|
+
b: Ref<number> | number
|
|
17
|
+
) {
|
|
18
|
+
return computed(() => unref(a) + unref(b))
|
|
19
|
+
}
|
|
20
|
+
/// ...as many lines as you want
|
|
21
|
+
const c = add(1, 2)
|
|
22
|
+
```
|
|
23
|
+
````
|
|
24
|
+
|
|
25
|
+
## With Line Highlighting Placeholder
|
|
26
|
+
|
|
27
|
+
Use `{*}` when you only need maxHeight:
|
|
28
|
+
|
|
29
|
+
````md
|
|
30
|
+
```ts {*}{maxHeight:'100px'}
|
|
31
|
+
// long code here
|
|
32
|
+
```
|
|
33
|
+
````
|
|
34
|
+
|
|
35
|
+
## Use Case
|
|
36
|
+
|
|
37
|
+
When code is too long to fit on one slide but you want to show it all with scrolling.
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: twoslash
|
|
3
|
+
description: Show TypeScript type information inline or on hover in code blocks
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# TwoSlash Integration
|
|
7
|
+
|
|
8
|
+
Show TypeScript type information inline or on hover.
|
|
9
|
+
|
|
10
|
+
## Usage
|
|
11
|
+
|
|
12
|
+
````md
|
|
13
|
+
```ts twoslash
|
|
14
|
+
import { ref } from 'vue'
|
|
15
|
+
|
|
16
|
+
const count = ref(0)
|
|
17
|
+
// ^?
|
|
18
|
+
```
|
|
19
|
+
````
|
|
20
|
+
|
|
21
|
+
## Features
|
|
22
|
+
|
|
23
|
+
- Type information on hover
|
|
24
|
+
- Inline type annotations with `^?`
|
|
25
|
+
- Errors and warnings display
|
|
26
|
+
- Full TypeScript compiler integration
|
|
27
|
+
|
|
28
|
+
## Annotations
|
|
29
|
+
|
|
30
|
+
```ts twoslash
|
|
31
|
+
const count = ref(0)
|
|
32
|
+
// ^?
|
|
33
|
+
// Shows: const count: Ref<number>
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Use Case
|
|
37
|
+
|
|
38
|
+
Perfect for TypeScript/JavaScript teaching materials where showing types helps understanding.
|
|
39
|
+
|
|
40
|
+
## Resources
|
|
41
|
+
|
|
42
|
+
- TwoSlash docs: https://twoslash.netlify.app/
|