-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Expand file tree
/
Copy pathfrontmatter.ts
More file actions
565 lines (553 loc) · 11.7 KB
/
frontmatter.ts
File metadata and controls
565 lines (553 loc) · 11.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
import type { BuiltinLayouts } from './builtin-layouts'
import type { SlidevThemeConfig } from './types'
export interface Headmatter extends HeadmatterConfig, Omit<Frontmatter, 'title'> {
/**
* Default frontmatter options applied to all slides
*/
defaults?: Frontmatter
}
export interface HeadmatterConfig extends TransitionOptions {
/**
* Title of the slides
*/
title?: string
/**
* String template to compose title
*
* @example "%s - Slidev" - to suffix " - Slidev" to all pages
* @default '%s - Slidev'
*/
titleTemplate?: string
/**
* Theme to use for the slides
*
* See https://sli.dev/guide/theme-addon#use-theme
* @default 'default'
*/
theme?: string
/**
* List of Slidev addons
*
* @default []
*/
addons?: string[]
/**
* Download remote assets in local using vite-plugin-remote-assets
*
* @default false
*/
remoteAssets?: boolean | 'dev' | 'build'
/**
* Show a download button in the SPA build,
* could also be a link to custom pdf
*
* @default false
*/
download?: boolean | string
/**
* Show a copy button in code blocks
*
* @default true
*/
codeCopy?: boolean
/**
* Show copy button in magic move code blocks
*
* `'final'` for only show copy button on the final step
* `'always'` or `true` for show copy button on all steps
*
* @default true
*/
magicMoveCopy?: boolean | 'final' | 'always'
/**
* The author of the slides
*/
author?: string
/**
* Information shows on the built SPA
* Can be a markdown string
*
* @default false
*/
info?: string | boolean
/**
* Prefer highlighter
*
* See https://sli.dev/custom/config-highlighter.html
* @default shiki
*/
highlighter?: 'shiki'
/**
* Enable Twoslash
*
* @default true
*/
twoslash?: boolean | 'dev' | 'build'
/**
* Show line numbers in code blocks
*
* @default false
*/
lineNumbers?: boolean
/**
* Force slides color schema
*
* @default 'auto'
*/
colorSchema?: 'dark' | 'light' | 'all' | 'auto'
/**
* Router mode for vue-router
*
* @default 'history'
*/
routerMode?: 'hash' | 'history'
/**
* Aspect ratio for slides
* should be like `16/9` or `1:1`
*
* @default '16/9'
*/
aspectRatio?: number | string
/**
* The actual width for slides canvas.
* unit in px.
*
* @default '980'
*/
canvasWidth?: number
/**
* Controls whether texts in slides are selectable
*
* @default true
*/
selectable?: boolean
/**
* Configure for themes, will inject intro root styles as
* `--slidev-theme-x` for attribute `x`
*
* This allows themes to have customization options in frontmatter
* Refer to themes' document for options avaliable
*
* @default {}
*/
themeConfig?: SlidevThemeConfig
/**
* Configure fonts for the slides and app
*
* @default {}
*/
fonts?: FontOptions
/**
* Configure the icon for app
*
* @default 'https://cdn.jsdelivr.net/gh/slidevjs/slidev/assets/favicon.png'
*/
favicon?: string
/**
* Options for drawings
*
* @default {}
*/
drawings?: DrawingsOptions
/**
* URL of PlantUML server used to render diagrams
*
* @default https://www.plantuml.com/plantuml
*/
plantUmlServer?: string
/**
* Enable slides recording
*
* @default 'dev'
*/
record?: boolean | 'dev' | 'build'
/**
* Expose the server to inbound requests (listen to `0.0.0.0`)
*
* Pass a string to set the password for accessing presenter mode.
*
* @default false
*/
remote?: string | boolean
/**
* Engine for Atomic CSS
*
* See https://unocss.dev/
* @deprecated
* @default 'unocss'
*/
css?: 'unocss'
/**
* Enable presenter mode
*
* @default true
*/
presenter?: boolean | 'dev' | 'build'
/**
* Enable browser exporter
*
* @default 'dev'
*/
browserExporter?: boolean | 'dev' | 'build'
/**
* Attributes to apply to the HTML element
*
* @default {}
*/
htmlAttrs?: Record<string, string>
/**
* Suppport Comark syntax
*
* https://comark.dev/syntax/markdown
*
* @default false
*/
comark?: boolean
/**
* @deprecated MDC is now Comark. Use the `comark` option instead
* @default false
*/
mdc?: boolean
/**
* Enable built-in editor
*
* @default true
*/
editor?: boolean
/**
* Enable context menu
*
* @default true
*/
contextMenu?: boolean | 'dev' | 'build' | null
/**
* Enable wake lock
*/
wakeLock?: boolean | 'dev' | 'build'
/**
* Force the filename used when exporting the presentation.
* The extension, e.g. .pdf, gets automatically added.
*
* @default ''
*/
exportFilename?: string | null
/**
* Enable Monaco
*
* See https://sli.dev/custom/config-monaco.html
* @default true
*/
monaco?: boolean | 'dev' | 'build'
/**
* Where to load monaco types from
*
* - `cdn` - load from CDN with `@typescript/ata`
* - `local` - load from local node_modules
*
* @default 'local'
*/
monacoTypesSource?: 'cdn' | 'local' | 'none'
/**
* Additional node packages to load as monaco types
*
* @default []
*/
monacoTypesAdditionalPackages?: string[]
/**
* Packages to ignore when loading monaco types
*
* @default []
*/
monacoTypesIgnorePackages?: string[]
/**
* Additional local modules to load as dependencies of monaco runnable
*
* @default []
*/
monacoRunAdditionalDeps?: string[]
/**
* Whether to run monaco runnable code in strict mode
*
* @default true
*/
monacoRunUseStrict?: boolean
/**
* Seo meta tags settings
*
* @default {}
*/
seoMeta?: SeoMeta
/**
* Auto replace words with `<ruby>` tags in notes
*
* @default {}
*
* @example
* ```yaml
* notesAutoRuby:
* 大丈夫: だいじょうぶ
* ```
*/
notesAutoRuby?: Record<string, string>
/**
* The expected duration of the slide
*
* @example
* ```yaml
* duration: 35min
* ```
*
* @default '30min'
*/
duration?: string | number
/**
* Timer mode
*
* @default 'stopwatch'
*/
timer?: 'stopwatch' | 'countdown'
/**
* Duration for shiki magic move transitions in milliseconds
*
* @default 800
*/
magicMoveDuration?: number
/**
* Default click animation for the slides
*/
clickAnimation?: string
/**
* Preload images extracted from slides for faster navigation.
*
* - `true` - enable with default look-ahead of 3 slides
* - `false` - disable image preloading
* - `{ ahead: number }` - enable with custom look-ahead window
*
* @default true
*/
preloadImages?: boolean | { ahead?: number }
}
export interface Frontmatter extends TransitionOptions {
/**
* Slide layout to use
*
* Default to 'cover' for the first slide, 'default' for the rest
*/
layout?: BuiltinLayouts | string
/**
* Custom class added to the slide root element
*/
class?: string | string[] | Record<string, unknown>
/**
* Manually specified the total clicks needed to this slide
*
* When not specified, the clicks will be calculated by the usage of v-clicks
*
* See https://sli.dev/guide/animations
*/
clicks?: number
/**
* Manually specified the total clicks needed to this slide to start
*
* @default 0
*/
clicksStart?: number
/**
* Preload the slide when the previous slide is active
* @default true
*/
preload?: boolean
/**
* Completely hide and disable the slide
*/
hide?: boolean
/**
* Same as `hide`, completely hide and disable the slide
*/
disabled?: boolean
/**
* Hide the slide for the `<Toc>` components
*
* See https://sli.dev/builtin/components#toc
*/
hideInToc?: boolean
/**
* Override the title for the `<TitleRenderer>` and `<Toc>` components
* Only if `title` has also been declared
*/
title?: string
/**
* Override the title level for the `<TitleRenderer>` and `<Toc>` components
* Only if `title` has also been declared
*/
level?: number
/**
* Create a route alias that can be used in the URL or with the `<Link>` component
*/
routeAlias?: string
/**
* Custom zoom level for the slide
* @default 1
*/
zoom?: number
/**
* Default click animation for the slide
*/
clickAnimation?: string
/**
* Store the positions of draggable elements
* Normally you don't need to set this manually
*
* See https://sli.dev/features/draggable
*/
dragPos?: Record<string, string>
/**
* Includes a markdown file
*
* See https://sli.dev/guide/syntax.html#importing-slides
*/
src?: string
// /**
// * Set time split for the end of the slide
// *
// * Accepts:
// * - 10:05
// * - 10m5s
// * - +10s (relative to the previous point)
// */
// timesplit?: string
// /**
// * Set title for the time split
// *
// * Default to slide title
// */
// timesplitTitle?: string
}
export interface DrawingsOptions {
/**
* Persist the drawings to disk
* Passing string to specify the directory (default to `.slidev/drawings`)
*
* @default false
*/
persist?: boolean | string
/**
* @default true
*/
enabled?: boolean | 'dev' | 'build'
/**
* Only allow drawing from presenter mode
*
* @default false
*/
presenterOnly?: boolean
/**
* Sync drawing for all instances
*
* @default true
*/
syncAll?: boolean
}
export interface FontOptions {
/**
* Sans serif fonts (default fonts for most text)
*/
sans?: string | string[]
/**
* Serif fonts
*/
serif?: string | string[]
/**
* Monospace fonts, for code blocks and etc.
*/
mono?: string | string[]
/**
* Load webfonts for custom CSS (does not apply anywhere by default)
*/
custom?: string | string[]
/**
* Weights for fonts
*
* @default [200, 400, 600]
*/
weights?: string | (string | number)[]
/**
* Import italic fonts
*
* @default false
*/
italic?: boolean
/**
* @default 'google'
*/
provider?: 'none' | 'google' | 'coollabs'
/**
* Specify web fonts names, will detect from `sans`, `mono`, `serif` if not provided
*/
webfonts?: string[]
/**
* Specify local fonts names, be excluded from webfonts
*/
local?: string[]
/**
* Use fonts fallback
*
* @default true
*/
fallbacks?: boolean
}
export type BuiltinSlideTransition = 'fade' | 'fade-out' | 'slide-up' | 'slide-down' | 'slide-left' | 'slide-right' | 'view-transition'
export interface TransitionOptions {
/**
* Page transition, powered by Vue's `<TransitionGroup/>`
*
* Built-in transitions:
* - fade
* - fade-out
* - slide-left
* - slide-right
* - slide-up
* - slide-down
* - view-transition
*
* See https://sli.dev/guide/animations.html#pages-transitions
*
* See https://vuejs.org/guide/built-ins/transition.html
*/
transition?: BuiltinSlideTransition | string | TransitionGroupProps | null
}
export interface TransitionGroupProps {
appear?: boolean
persisted?: boolean
tag?: string
moveClass?: string
css?: boolean
duration?: number | {
enter: number
leave: number
}
enterFromClass?: string
enterActiveClass?: string
enterToClass?: string
appearFromClass?: string
appearActiveClass?: string
appearToClass?: string
leaveFromClass?: string
leaveActiveClass?: string
leaveToClass?: string
}
/**
* The following type should map to unhead MataFlat type
*/
export interface SeoMeta {
ogTitle?: string
ogDescription?: string
ogImage?: string
ogUrl?: string
twitterCard?: 'summary' | 'summary_large_image' | 'app' | 'player'
twitterSite?: string
twitterTitle?: string
twitterDescription?: string
twitterImage?: string
twitterUrl?: string
}