@slidev/cli 0.48.0-beta.3 → 0.48.0-beta.4

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/template.md CHANGED
@@ -14,6 +14,9 @@ info: |
14
14
  Presentation slides for developers.
15
15
 
16
16
  Learn more at [Sli.dev](https://sli.dev)
17
+ transition: slide-left
18
+ title: Welcome to Slidev
19
+ mdc: true
17
20
  ---
18
21
 
19
22
  # Welcome to Slidev
@@ -21,20 +24,27 @@ info: |
21
24
  Presentation slides for developers
22
25
 
23
26
  <div class="pt-12">
24
- <span @click="$slidev.nav.next" class="px-2 p-1 rounded cursor-pointer" hover="bg-white bg-opacity-10">
27
+ <span @click="$slidev.nav.next" class="px-2 py-1 rounded cursor-pointer" hover="bg-white bg-opacity-10">
25
28
  Press Space for next page <carbon:arrow-right class="inline"/>
26
29
  </span>
27
30
  </div>
28
31
 
29
- <a href="https://github.com/slidevjs/slidev" target="_blank" alt="GitHub" title="Open in GitHub"
30
- class="abs-br m-6 text-xl slidev-icon-btn opacity-50 !border-none !hover:text-white">
31
- <carbon-logo-github />
32
- </a>
32
+ <div class="abs-br m-6 flex gap-2">
33
+ <button @click="$slidev.nav.openInEditor()" title="Open in Editor" class="text-xl slidev-icon-btn opacity-50 !border-none !hover:text-white">
34
+ <carbon:edit />
35
+ </button>
36
+ <a href="https://github.com/slidevjs/slidev" target="_blank" alt="GitHub" title="Open in GitHub"
37
+ class="text-xl slidev-icon-btn opacity-50 !border-none !hover:text-white">
38
+ <carbon-logo-github />
39
+ </a>
40
+ </div>
33
41
 
34
42
  <!--
35
43
  The last comment block of each slide will be treated as slide notes. It will be visible and editable in Presenter Mode along with the slide. [Read more in the docs](https://sli.dev/guide/syntax.html#notes)
36
44
  -->
37
45
 
46
+ ---
47
+ transition: fade-out
38
48
  ---
39
49
 
40
50
  # What is Slidev?
@@ -71,6 +81,25 @@ h1 {
71
81
  }
72
82
  </style>
73
83
 
84
+ <!--
85
+ Here is another comment.
86
+ -->
87
+
88
+ ---
89
+ layout: default
90
+ ---
91
+
92
+ # Table of contents
93
+
94
+ ```html
95
+ <Toc minDepth="1" maxDepth="1"></Toc>
96
+ ```
97
+
98
+ <Toc maxDepth="1"></Toc>
99
+
100
+ ---
101
+ transition: slide-up
102
+ level: 2
74
103
  ---
75
104
 
76
105
  # Navigation
@@ -82,7 +111,7 @@ Hover on the bottom-left corner to see the navigation's controls panel, [learn m
82
111
  | | |
83
112
  | --- | --- |
84
113
  | <kbd>right</kbd> / <kbd>space</kbd>| next animation or slide |
85
- | <kbd>left</kbd> / <kbd>shift</kbd><kbd>space</kbd>| previous animation or slide |
114
+ | <kbd>left</kbd> / <kbd>shift</kbd><kbd>space</kbd> | previous animation or slide |
86
115
  | <kbd>up</kbd> | previous slide |
87
116
  | <kbd>down</kbd> | next slide |
88
117
 
@@ -102,26 +131,41 @@ image: https://source.unsplash.com/collection/94734566/1920x1080
102
131
 
103
132
  # Code
104
133
 
105
- Use code snippets and get the highlighting directly!
134
+ Use code snippets and get the highlighting directly, and even types hover![^1]
106
135
 
107
- <!-- https://sli.dev/guide/syntax.html#line-highlighting -->
136
+ ```ts {all|5|7|7-8|10|all} twoslash
137
+ // TwoSlash enables TypeScript hover information
138
+ // and errors in markdown code blocks
139
+ // More at https://shiki.style/packages/twoslash
108
140
 
109
- ```ts {all|2|1-6|9|all}
110
- interface User {
111
- id: number
112
- firstName: string
113
- lastName: string
114
- role: string
115
- }
141
+ import { computed, ref } from 'vue'
116
142
 
117
- function updateUser(id: number, update: User) {
118
- const user = getUser(id)
119
- const newUser = { ...user, ...update }
120
- saveUser(id, newUser)
121
- }
143
+ const count = ref(0)
144
+ const doubled = computed(() => count.value * 2)
145
+
146
+ doubled.value = 2
122
147
  ```
123
148
 
124
- <arrow v-click="[3, 4]" x1="400" y1="420" x2="230" y2="330" color="#564" width="3" arrowSize="1" />
149
+ <arrow v-click="[4, 5]" x1="350" y1="310" x2="195" y2="334" color="#953" width="2" arrowSize="1" />
150
+
151
+ <!-- This allow you to embed external code blocks -->
152
+ <!-- <<< @/snippets/external.ts#snippet -->
153
+
154
+ <!-- Footer -->
155
+ [^1]: [Learn More](https://sli.dev/guide/syntax.html#line-highlighting)
156
+
157
+ <!-- Inline style -->
158
+ <style>
159
+ .footnotes-sep {
160
+ @apply mt-5 opacity-10;
161
+ }
162
+ .footnotes {
163
+ @apply text-sm opacity-75;
164
+ }
165
+ .footnote-backref {
166
+ display: none;
167
+ }
168
+ </style>
125
169
 
126
170
  ---
127
171
 
@@ -155,13 +199,23 @@ Check out [the guides](https://sli.dev/builtin/components.html) for more.
155
199
  </div>
156
200
  </div>
157
201
 
202
+ <!--
203
+ Presenter note with **bold**, *italic*, and ~~striked~~ text.
204
+
205
+ Also, HTML elements are valid:
206
+ <div class="flex w-full">
207
+ <span style="flex-grow: 1;">Left content</span>
208
+ <span>Right content</span>
209
+ </div>
210
+ -->
211
+
158
212
  ---
159
213
  class: px-20
160
214
  ---
161
215
 
162
216
  # Themes
163
217
 
164
- Slidev comes with powerful theming support. Themes are able to provide styles, layouts, components, or even configurations for tools. Switching between themes by just **one edit** in your frontmatter:
218
+ Slidev comes with powerful theming support. Themes can provide styles, layouts, components, or even configurations for tools. Switching between themes by just **one edit** in your frontmatter:
165
219
 
166
220
  <div grid="~ cols-2 gap-2" m="t-2">
167
221
 
@@ -276,7 +330,7 @@ LaTeX is supported out-of-box powered by [KaTeX](https://katex.org/).
276
330
  Inline $\sqrt{3x-1}+(1+x)^2$
277
331
 
278
332
  Block
279
- $$
333
+ $$ {1|3|all}
280
334
  \begin{array}{c}
281
335
 
282
336
  \nabla \times \vec{\mathbf{B}} -\, \frac1c\, \frac{\partial\vec{\mathbf{E}}}{\partial t} &
@@ -299,9 +353,9 @@ $$
299
353
 
300
354
  You can create diagrams / graphs from textual descriptions, directly in your Markdown.
301
355
 
302
- <div class="grid grid-cols-2 gap-4 pt-4 -mb-6">
356
+ <div class="grid grid-cols-4 gap-5 pt-4 -mb-6">
303
357
 
304
- ```mermaid {scale: 0.9}
358
+ ```mermaid {scale: 0.5, alt: 'A simple sequence diagram'}
305
359
  sequenceDiagram
306
360
  Alice->John: Hello John, how are you?
307
361
  Note over Alice,John: A typical interaction
@@ -314,6 +368,59 @@ C -->|One| D[Result 1]
314
368
  C -->|Two| E[Result 2]
315
369
  ```
316
370
 
371
+ ```mermaid
372
+ mindmap
373
+ root((mindmap))
374
+ Origins
375
+ Long history
376
+ ::icon(fa fa-book)
377
+ Popularisation
378
+ British popular psychology author Tony Buzan
379
+ Research
380
+ On effectivness<br/>and features
381
+ On Automatic creation
382
+ Uses
383
+ Creative techniques
384
+ Strategic planning
385
+ Argument mapping
386
+ Tools
387
+ Pen and paper
388
+ Mermaid
389
+ ```
390
+
391
+ ```plantuml {scale: 0.7}
392
+ @startuml
393
+
394
+ package "Some Group" {
395
+ HTTP - [First Component]
396
+ [Another Component]
397
+ }
398
+
399
+ node "Other Groups" {
400
+ FTP - [Second Component]
401
+ [First Component] --> FTP
402
+ }
403
+
404
+ cloud {
405
+ [Example 1]
406
+ }
407
+
408
+ database "MySql" {
409
+ folder "This is my folder" {
410
+ [Folder 3]
411
+ }
412
+ frame "Foo" {
413
+ [Frame 4]
414
+ }
415
+ }
416
+
417
+ [Another Component] --> [Example 1]
418
+ [Example 1] --> [Folder 3]
419
+ [Folder 3] --> [Frame 4]
420
+
421
+ @enduml
422
+ ```
423
+
317
424
  </div>
318
425
 
319
426
  [Learn More](https://sli.dev/guide/syntax.html#diagrams)
@@ -325,4 +432,4 @@ class: text-center
325
432
 
326
433
  # Learn More
327
434
 
328
- [Documentations](https://sli.dev) / [GitHub Repo](https://github.com/slidevjs/slidev)
435
+ [Documentations](https://sli.dev) · [GitHub](https://github.com/slidevjs/slidev) · [Showcases](https://sli.dev/showcases.html)
@@ -1,72 +0,0 @@
1
- // node/utils.ts
2
- import { join } from "node:path";
3
- import { createRequire } from "node:module";
4
- import { fileURLToPath } from "node:url";
5
- import { ensurePrefix, slash } from "@antfu/utils";
6
- import isInstalledGlobally from "is-installed-globally";
7
- import { resolvePath } from "mlly";
8
- import globalDirs from "global-directory";
9
- var require2 = createRequire(import.meta.url);
10
- function toAtFS(path) {
11
- return `/@fs${ensurePrefix("/", slash(path))}`;
12
- }
13
- async function resolveImportPath(importName, ensure = false) {
14
- try {
15
- return await resolvePath(importName, {
16
- url: fileURLToPath(import.meta.url)
17
- });
18
- } catch {
19
- }
20
- if (isInstalledGlobally) {
21
- try {
22
- return require2.resolve(join(globalDirs.yarn.packages, importName));
23
- } catch {
24
- }
25
- try {
26
- return require2.resolve(join(globalDirs.npm.packages, importName));
27
- } catch {
28
- }
29
- }
30
- if (ensure)
31
- throw new Error(`Failed to resolve package "${importName}"`);
32
- return void 0;
33
- }
34
- async function resolveGlobalImportPath(importName) {
35
- try {
36
- return await resolvePath(importName, {
37
- url: fileURLToPath(import.meta.url)
38
- });
39
- } catch {
40
- }
41
- try {
42
- return require2.resolve(join(globalDirs.yarn.packages, importName));
43
- } catch {
44
- }
45
- try {
46
- return require2.resolve(join(globalDirs.npm.packages, importName));
47
- } catch {
48
- }
49
- throw new Error(`Failed to resolve global package "${importName}"`);
50
- }
51
- function stringifyMarkdownTokens(tokens) {
52
- return tokens.map((token) => token.children?.filter((t) => ["text", "code_inline"].includes(t.type) && !t.content.match(/^\s*$/)).map((t) => t.content.trim()).join(" ")).filter(Boolean).join(" ");
53
- }
54
- function generateGoogleFontsUrl(options) {
55
- const weights = options.weights.flatMap((i) => options.italic ? [`0,${i}`, `1,${i}`] : [`${i}`]).sort().join(";");
56
- const fonts = options.webfonts.map((i) => `family=${i.replace(/^(['"])(.*)\1$/, "$1").replace(/\s+/g, "+")}:${options.italic ? "ital," : ""}wght@${weights}`).join("&");
57
- return `https://fonts.googleapis.com/css2?${fonts}&display=swap`;
58
- }
59
- async function packageExists(name) {
60
- if (await resolveImportPath(`${name}/package.json`).catch(() => false))
61
- return true;
62
- return false;
63
- }
64
-
65
- export {
66
- toAtFS,
67
- resolveImportPath,
68
- resolveGlobalImportPath,
69
- stringifyMarkdownTokens,
70
- generateGoogleFontsUrl,
71
- packageExists
72
- };