@slidev/docs 51.6.2 → 51.7.1
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/custom/config-code-runners.md +1 -1
- package/custom/config-context-menu.md +1 -1
- package/custom/config-highlighter.md +2 -4
- package/custom/config-katex.md +1 -1
- package/custom/config-mermaid.md +1 -1
- package/custom/config-monaco.md +2 -3
- package/custom/config-parser.md +4 -4
- package/custom/config-routes.md +1 -1
- package/custom/config-shortcuts.md +1 -1
- package/custom/config-transformers.md +1 -1
- package/custom/config-unocss.md +1 -1
- package/custom/config-vite.md +1 -1
- package/custom/config-vue.md +1 -1
- package/custom/directory-structure.md +1 -2
- package/guide/global-context.md +2 -6
- package/guide/index.md +1 -1
- package/guide/write-addon.md +1 -1
- package/guide/write-layout.md +2 -4
- package/guide/write-theme.md +3 -3
- package/package.json +7 -6
|
@@ -10,7 +10,7 @@ Create `./setup/code-runners.ts` with the following content:
|
|
|
10
10
|
|
|
11
11
|
<!-- eslint-disable import/first -->
|
|
12
12
|
|
|
13
|
-
```ts twoslash
|
|
13
|
+
```ts twoslash [setup/code-runners.ts]
|
|
14
14
|
declare const executePythonCodeRemotely: (code: string) => Promise<string>
|
|
15
15
|
declare const sanitizeHtml: (html: string) => string
|
|
16
16
|
// ---cut---
|
|
@@ -8,7 +8,7 @@ Create `./setup/context-menu.ts` with the following content:
|
|
|
8
8
|
|
|
9
9
|
<!-- eslint-disable import/first -->
|
|
10
10
|
|
|
11
|
-
```ts twoslash
|
|
11
|
+
```ts twoslash [./setup/context-menu.ts]
|
|
12
12
|
// ---cut---
|
|
13
13
|
import { useNav } from '@slidev/client'
|
|
14
14
|
import { defineContextMenuSetup } from '@slidev/types'
|
|
@@ -8,8 +8,7 @@ Slidev uses [Shiki](https://github.com/shikijs/shiki) as the code highlighter. I
|
|
|
8
8
|
|
|
9
9
|
Create `./setup/shiki.ts` file with the following content:
|
|
10
10
|
|
|
11
|
-
```ts twoslash
|
|
12
|
-
/* ./setup/shiki.ts */
|
|
11
|
+
```ts twoslash [setup/shiki.ts]
|
|
13
12
|
import { defineShikiSetup } from '@slidev/types'
|
|
14
13
|
|
|
15
14
|
export default defineShikiSetup(() => {
|
|
@@ -29,8 +28,7 @@ If you want to add custom theme or language (TextMate grammar/themes in JSON), y
|
|
|
29
28
|
|
|
30
29
|
<!-- eslint-disable import/first-->
|
|
31
30
|
|
|
32
|
-
```ts twoslash
|
|
33
|
-
/* ./setup/shiki.ts */
|
|
31
|
+
```ts twoslash [setup/shiki.ts]
|
|
34
32
|
import { defineShikiSetup } from '@slidev/types'
|
|
35
33
|
// ---cut-start---
|
|
36
34
|
// @ts-expect-error missing types
|
package/custom/config-katex.md
CHANGED
package/custom/config-mermaid.md
CHANGED
package/custom/config-monaco.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
Create `./setup/monaco.ts` with the following content:
|
|
6
6
|
|
|
7
|
-
```ts twoslash
|
|
7
|
+
```ts twoslash [./setup/monaco.ts]
|
|
8
8
|
import { defineMonacoSetup } from '@slidev/types'
|
|
9
9
|
|
|
10
10
|
export default defineMonacoSetup(async (monaco) => {
|
|
@@ -71,8 +71,7 @@ console.log('HelloWorld')
|
|
|
71
71
|
|
|
72
72
|
Alternatively if you would like these options to be applied to every Monaco instance, you can return them in the `defineMonacoSetup` function
|
|
73
73
|
|
|
74
|
-
```ts twoslash
|
|
75
|
-
// ./setup/monaco.ts
|
|
74
|
+
```ts twoslash [./setup/monaco.ts]
|
|
76
75
|
import { defineMonacoSetup } from '@slidev/types'
|
|
77
76
|
|
|
78
77
|
export default defineMonacoSetup(() => {
|
package/custom/config-parser.md
CHANGED
|
@@ -26,7 +26,7 @@ The preparser (step 1 above) is highly extensible and allows you to implement cu
|
|
|
26
26
|
|
|
27
27
|
To customize it, create a `./setup/preparser.ts` file with the following content:
|
|
28
28
|
|
|
29
|
-
```ts twoslash
|
|
29
|
+
```ts twoslash [./setup/preparser.ts]
|
|
30
30
|
import { definePreparserSetup } from '@slidev/types'
|
|
31
31
|
|
|
32
32
|
export default definePreparserSetup(({ filepath, headmatter, mode }) => {
|
|
@@ -76,7 +76,7 @@ see you next time
|
|
|
76
76
|
|
|
77
77
|
To allow these `@src:` and `@cover:` syntaxes, create a `./setup/preparser.ts` file with the following content:
|
|
78
78
|
|
|
79
|
-
```ts twoslash
|
|
79
|
+
```ts twoslash [./setup/preparser.ts]
|
|
80
80
|
import { definePreparserSetup } from '@slidev/types'
|
|
81
81
|
|
|
82
82
|
export default definePreparserSetup(() => {
|
|
@@ -157,7 +157,7 @@ Here we used an underscore in `_scale` to avoid possible conflicts with existing
|
|
|
157
157
|
|
|
158
158
|
To handle this `_scale: ...` syntax in the frontmatter, create a `./setup/preparser.ts` file with the following content:
|
|
159
159
|
|
|
160
|
-
```ts twoslash
|
|
160
|
+
```ts twoslash [./setup/preparser.ts]
|
|
161
161
|
import { definePreparserSetup } from '@slidev/types'
|
|
162
162
|
|
|
163
163
|
export default definePreparserSetup(() => {
|
|
@@ -207,7 +207,7 @@ Here we used an underscore in `_note` to avoid possible conflicts with existing
|
|
|
207
207
|
|
|
208
208
|
To handle this `_note: ...` syntax in the frontmatter, create a `./setup/preparser.ts` file with the following content:
|
|
209
209
|
|
|
210
|
-
```ts twoslash
|
|
210
|
+
```ts twoslash [./setup/preparser.ts]
|
|
211
211
|
import fs, { promises as fsp } from 'node:fs'
|
|
212
212
|
import { definePreparserSetup } from '@slidev/types'
|
|
213
213
|
|
package/custom/config-routes.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
This setup function allows you to define custom transformers for the markdown content of **each slide**. This is useful when you want to add custom Markdown syntax and render custom code blocks. To start, create a `./setup/transformers.ts` file with the following content:
|
|
6
6
|
|
|
7
|
-
````ts twoslash
|
|
7
|
+
````ts twoslash [setup/transformers.ts]
|
|
8
8
|
import type { MarkdownTransformContext } from '@slidev/types'
|
|
9
9
|
import { defineTransformersSetup } from '@slidev/types'
|
|
10
10
|
|
package/custom/config-unocss.md
CHANGED
|
@@ -31,7 +31,7 @@ You can therefore style your content the way you want. For example:
|
|
|
31
31
|
|
|
32
32
|
You can create `uno.config.ts` under the root of your project to extend the builtin configurations
|
|
33
33
|
|
|
34
|
-
```ts twoslash
|
|
34
|
+
```ts twoslash [uno.config.ts]
|
|
35
35
|
import { defineConfig } from 'unocss'
|
|
36
36
|
|
|
37
37
|
export default defineConfig({
|
package/custom/config-vite.md
CHANGED
|
@@ -21,7 +21,7 @@ To configure the built-in plugins listed above, create a `vite.config.ts` with t
|
|
|
21
21
|
|
|
22
22
|
<!-- eslint-disable import/first -->
|
|
23
23
|
|
|
24
|
-
```ts twoslash
|
|
24
|
+
```ts twoslash [vite.config.ts]
|
|
25
25
|
/// <reference types="@slidev/types" />
|
|
26
26
|
import type MarkdownIt from 'markdown-it'
|
|
27
27
|
declare const MyPlugin: (md: any) => void
|
package/custom/config-vue.md
CHANGED
|
@@ -93,8 +93,7 @@ The `index.html` provides the ability to inject meta tags and/or scripts to the
|
|
|
93
93
|
|
|
94
94
|
For example, for the following custom `index.html`:
|
|
95
95
|
|
|
96
|
-
```html
|
|
97
|
-
<!-- ./index.html -->
|
|
96
|
+
```html [index.html]
|
|
98
97
|
<head>
|
|
99
98
|
<link rel="preconnect" href="https://fonts.gstatic.com">
|
|
100
99
|
<link href="https://fonts.googleapis.com/css2?family=Fira+Code:wght@400;600&family=Nunito+Sans:wght@200;400;600&display=swap" rel="stylesheet">
|
package/guide/global-context.md
CHANGED
|
@@ -6,17 +6,13 @@ Slidev injects several global context values for advanced navigation controls.
|
|
|
6
6
|
|
|
7
7
|
You can access them directly in your slides or components:
|
|
8
8
|
|
|
9
|
-
```md
|
|
10
|
-
<!-- slides.md -->
|
|
11
|
-
|
|
9
|
+
```md [slides.md]
|
|
12
10
|
# Page 1
|
|
13
11
|
|
|
14
12
|
Current page is: {{ $nav.currentPage }}
|
|
15
13
|
```
|
|
16
14
|
|
|
17
|
-
```vue
|
|
18
|
-
<!-- Foo.vue -->
|
|
19
|
-
|
|
15
|
+
```vue [Foo.vue]
|
|
20
16
|
<template>
|
|
21
17
|
<div>Title: {{ $slidev.configs.title }}</div>
|
|
22
18
|
<button @click="$nav.next">
|
package/guide/index.md
CHANGED
|
@@ -117,7 +117,7 @@ Slidev provides a set of commands in its CLI. Here are some common ones:
|
|
|
117
117
|
|
|
118
118
|
To run these commands, you can add them to your `package.json` scripts (which has been done for you if the project was created via `npm init slidev`):
|
|
119
119
|
|
|
120
|
-
```json
|
|
120
|
+
```json [package.json]
|
|
121
121
|
{
|
|
122
122
|
"scripts": {
|
|
123
123
|
"dev": "slidev --open",
|
package/guide/write-addon.md
CHANGED
package/guide/write-layout.md
CHANGED
|
@@ -17,8 +17,7 @@ Layouts are Vue components, so you can use all the features of Vue in them.
|
|
|
17
17
|
|
|
18
18
|
In the layout component, use `<slot/>` (the default slot) for the slide content:
|
|
19
19
|
|
|
20
|
-
```vue
|
|
21
|
-
<!-- default.vue -->
|
|
20
|
+
```vue [default.vue]
|
|
22
21
|
<template>
|
|
23
22
|
<div class="slidev-layout default">
|
|
24
23
|
<slot />
|
|
@@ -28,8 +27,7 @@ In the layout component, use `<slot/>` (the default slot) for the slide content:
|
|
|
28
27
|
|
|
29
28
|
You can also have [named slots](https://vuejs.org/guide/components/slots.html) for more complex layouts:
|
|
30
29
|
|
|
31
|
-
```vue
|
|
32
|
-
<!-- split.vue -->
|
|
30
|
+
```vue [split.vue]
|
|
33
31
|
<template>
|
|
34
32
|
<div class="slidev-layout split">
|
|
35
33
|
<div class="left">
|
package/guide/write-theme.md
CHANGED
|
@@ -48,7 +48,7 @@ Basically, the way to provide global styles, layouts, components and configure t
|
|
|
48
48
|
|
|
49
49
|
To provide default Slidev configurations, you can add a `slidev.defaults` field in the `package.json` file, which will be merged with the user's configurations:
|
|
50
50
|
|
|
51
|
-
```json
|
|
51
|
+
```json [package.json]
|
|
52
52
|
{
|
|
53
53
|
"slidev": {
|
|
54
54
|
"defaults": {
|
|
@@ -77,7 +77,7 @@ An error message will be shown when the an incompatible version is used.
|
|
|
77
77
|
|
|
78
78
|
By default, Slidev assumes themes support both light mode and dark mode. If you only want your theme to be presented in a specific color schema, you need to specify it explicitly in the `package.json`:
|
|
79
79
|
|
|
80
|
-
```json
|
|
80
|
+
```json [package.json]
|
|
81
81
|
{
|
|
82
82
|
"slidev": {
|
|
83
83
|
"colorSchema": "light" // or "dark" or "both"
|
|
@@ -89,7 +89,7 @@ By default, Slidev assumes themes support both light mode and dark mode. If you
|
|
|
89
89
|
|
|
90
90
|
You can preview your theme when developing by using a demo slide deck. To do so, create a `./slides.md` file with the following headmatter:
|
|
91
91
|
|
|
92
|
-
```md
|
|
92
|
+
```md [slides.md]
|
|
93
93
|
---
|
|
94
94
|
theme: ./ # Use the theme in the current directory
|
|
95
95
|
---
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@slidev/docs",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "51.
|
|
4
|
+
"version": "51.7.1",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"funding": "https://github.com/sponsors/antfu",
|
|
7
7
|
"homepage": "https://sli.dev",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
],
|
|
18
18
|
"devDependencies": {
|
|
19
19
|
"@antfu/utils": "^9.2.0",
|
|
20
|
-
"@iconify/json": "^2.2.
|
|
20
|
+
"@iconify/json": "^2.2.339",
|
|
21
21
|
"@shikijs/vitepress-twoslash": "^3.4.2",
|
|
22
22
|
"@types/node": "^22.15.18",
|
|
23
23
|
"@unocss/reset": "^66.1.2",
|
|
@@ -33,11 +33,12 @@
|
|
|
33
33
|
"unplugin-vue-components": "^28.5.0",
|
|
34
34
|
"vite-plugin-inspect": "^11.0.1",
|
|
35
35
|
"vitepress": "^2.0.0-alpha.5",
|
|
36
|
-
"vitepress-plugin-
|
|
36
|
+
"vitepress-plugin-group-icons": "^1.5.5",
|
|
37
|
+
"vitepress-plugin-llms": "^1.2.0",
|
|
37
38
|
"vue": "^3.5.14",
|
|
38
|
-
"@slidev/
|
|
39
|
-
"@slidev/
|
|
40
|
-
"@slidev/
|
|
39
|
+
"@slidev/client": "51.7.1",
|
|
40
|
+
"@slidev/types": "51.7.1",
|
|
41
|
+
"@slidev/parser": "51.7.1"
|
|
41
42
|
},
|
|
42
43
|
"scripts": {
|
|
43
44
|
"dev": "vitepress",
|