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