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