返回 reveal.js
config.d.ts
根目录 / dist / config.d.ts
1 /**
2 * Slide transition styles.
3 *
4 * @see {@link https://revealjs.com/transitions/}
5 */
6 type TransitionStyle = 'none' | 'fade' | 'slide' | 'convex' | 'concave' | 'zoom';
7 /**
8 * Slide transition speeds.
9 *
10 * @see {@link https://revealjs.com/transitions/}
11 */
12 type TransitionSpeed = 'default' | 'fast' | 'slow';
13 /**
14 * Fragment animation classes.
15 *
16 * @see {@link https://revealjs.com/fragments/}
17 */
18 type FragmentAnimation = 'fade-out' | 'fade-up' | 'fade-down' | 'fade-left' | 'fade-right' | 'fade-in-then-out' | 'fade-in-then-semi-out' | 'grow' | 'shrink' | 'strike' | 'highlight-red' | 'highlight-blue' | 'highlight-green' | 'highlight-current-red' | 'highlight-current-blue' | 'highlight-current-green' | (string & {});
19 /**
20 * katex - Math Plugin configuration
21 *
22 * @see {@link https://github.com/reveal/revealjs.com/blob/master/src/math.md}
23 * @see {@link https://github.com/hakimel/reveal.js/blob/master/plugin/math/katex.js}
24 */
25 interface KatexConfig {
26 local?: string;
27 version?: string;
28 delimiters?: Array<{
29 left: string;
30 right: string;
31 display: boolean;
32 }>;
33 ignoredTags?: string[];
34 }
35 /**
36 * mathjax2 - Math Plugin configuration
37 *
38 * @see {@link https://github.com/reveal/revealjs.com/blob/master/src/math.md}
39 * @see {@link https://github.com/hakimel/reveal.js/blob/master/plugin/math/mathjax2.js}
40 */
41 interface Mathjax2Config {
42 mathjax?: string;
43 config?: string;
44 tex2jax?: {
45 inlineMath?: any;
46 skipTags?: string[];
47 };
48 }
49 /**
50 * mathjax3 - Math Plugin configuration
51 *
52 * @see {@link https://github.com/reveal/revealjs.com/blob/master/src/math.md}
53 * @see {@link https://github.com/hakimel/reveal.js/blob/master/plugin/math/mathjax3.js}
54 */
55 interface Mathjax3Config {
56 mathjax?: string;
57 tex?: {
58 inlineMath?: any;
59 };
60 options?: {
61 skipHtmlTags: string[];
62 };
63 }
64 /**
65 * mathjax4 - Math Plugin configuration
66 *
67 * @see {@link https://github.com/reveal/revealjs.com/blob/master/src/math.md}
68 * @see {@link https://github.com/hakimel/reveal.js/blob/master/plugin/math/mathjax4.js}
69 */
70 interface Mathjax4Config {
71 mathjax?: string;
72 tex?: {
73 inlineMath?: Array<[string, string]>;
74 displayMath?: Array<[string, string]>;
75 macros?: Record<string, string | [string, number]>;
76 };
77 options?: {
78 skipHtmlTags?: string[];
79 };
80 startup?: {
81 ready?: () => void;
82 };
83 output?: {
84 font?: string;
85 displayOverflow?: string;
86 linebreaks?: {
87 inline?: boolean;
88 width?: string;
89 lineleading?: number;
90 LinebreakVisitor?: unknown;
91 };
92 };
93 }
94 /**
95 * Highlight Plugin configuration
96 *
97 * @see {@link https://github.com/hakimel/reveal.js/blob/master/plugin/highlight/plugin.js}
98 */
99 interface HighlightConfig {
100 highlightOnLoad?: boolean;
101 escapeHTML?: boolean;
102 beforeHighlight?: (...args: any) => any;
103 }
104 /**
105 * Markdown Plugin configuration
106 *
107 * @see {@link https://github.com/reveal/revealjs.com/blob/master/src/markdown.md}
108 * @see {@link https://marked.js.org/using_advanced}
109 */
110 interface MarkdownConfig {
111 async?: boolean;
112 baseUrl?: string;
113 breaks?: boolean;
114 gfm?: boolean;
115 headerIds?: boolean;
116 headerPrefix?: string;
117 highlight?: (...args: any) => any;
118 langPrefix?: string;
119 mangle?: boolean;
120 pedantic?: boolean;
121 renderer?: object;
122 sanitize?: boolean;
123 sanitizer?: (...args: any) => any;
124 silent?: boolean;
125 smartLists?: boolean;
126 smartypants?: boolean;
127 tokenizer?: object;
128 walkTokens?: (...args: any) => any;
129 xhtml?: boolean;
130 separator?: string;
131 verticalSeparator?: string;
132 notesSeparator?: string;
133 attributes?: string;
134 }
135 /**
136 * Configuration object for reveal.js.
137 *
138 * @see {@link https://revealjs.com/config/}
139 */
140 interface RevealConfig {
141 /**
142 * The "normal" size of the presentation, aspect ratio will be preserved
143 * when the presentation is scaled to fit different resolutions
144 *
145 * @see {@link https://revealjs.com/presentation-size/}
146 *
147 * @defaultValue 960
148 */
149 width?: number | string;
150 /**
151 * The "normal" size of the presentation, aspect ratio will be preserved
152 * when the presentation is scaled to fit different resolutions
153 *
154 * @see {@link https://revealjs.com/presentation-size/}
155 *
156 * @defaultValue 700
157 */
158 height?: number | string;
159 /**
160 * Factor of the display size that should remain empty around the content
161 *
162 * @see {@link https://revealjs.com/presentation-size/}
163 *
164 * @defaultValue 0.04
165 */
166 margin?: number;
167 /**
168 * The smallest possible factor to scale content down by in order to fit
169 * the available viewport.
170 *
171 * @see {@link https://revealjs.com/presentation-size/}
172 *
173 * @defaultValue 0.2
174 */
175 minScale?: number;
176 /**
177 * The largest possible factor to scale content up by in order to cover
178 * the available viewport.
179 *
180 * @see {@link https://revealjs.com/presentation-size/}
181 *
182 * @defaultValue 2.0
183 */
184 maxScale?: number;
185 /**
186 * Display presentation control arrows
187 * - true: Display controls in all views
188 * - false: Hide controls in all views
189 * - 'speaker': Display controls only in the speaker view
190 *
191 * @defaultValue true
192 */
193 controls?: boolean | 'speaker' | 'speaker-only';
194 /**
195 * Help the user learn the controls by providing hints, for example by
196 * bouncing the down arrow when they first encounter a vertical slide
197 *
198 * @defaultValue true
199 */
200 controlsTutorial?: boolean;
201 /**
202 * Determines where controls appear, "edges" or "bottom-right"
203 *
204 * @defaultValue 'bottom-right'
205 */
206 controlsLayout?: 'edges' | 'bottom-right';
207 /**
208 * Visibility rule for backwards navigation arrows; "faded", "hidden"
209 * or "visible"
210 *
211 * @defaultValue 'faded'
212 */
213 controlsBackArrows?: 'faded' | 'hidden' | 'visible';
214 /**
215 * Display a presentation progress bar
216 *
217 * @defaultValue true
218 */
219 progress?: boolean;
220 /**
221 * Display the page number of the current slide
222 * - true: Show slide number
223 * - false: Hide slide number
224 *
225 * Can optionally be set as a string that specifies the number formatting:
226 * - "h.v": Horizontal . vertical slide number (default)
227 * - "h/v": Horizontal / vertical slide number
228 * - "c": Flattened slide number
229 * - "c/t": Flattened slide number / total slides
230 *
231 * Alternatively, you can provide a function that returns the slide
232 * number for the current slide. The function should take in a slide
233 * object and return an array with one string [slideNumber] or
234 * three strings [n1,delimiter,n2]. See #formatSlideNumber().
235 *
236 * @defaultValue false
237 */
238 slideNumber?: boolean | 'h.v' | 'h/v' | 'c' | 'c/t' | ((slide: any) => string | [string, string, string]);
239 /**
240 * Can be used to limit the contexts in which the slide number appears
241 * - "all": Always show the slide number
242 * - "print": Only when printing to PDF
243 * - "speaker": Only in the speaker view
244 *
245 * @defaultValue 'all'
246 */
247 showSlideNumber?: 'all' | 'print' | 'speaker';
248 /**
249 * Use 1 based indexing for # links to match slide number (default is zero
250 * based)
251 *
252 * @defaultValue false
253 */
254 hashOneBasedIndex?: boolean;
255 /**
256 * Add the current slide number to the URL hash so that reloading the
257 * page/copying the URL will return you to the same slide
258 *
259 * @defaultValue false
260 */
261 hash?: boolean;
262 /**
263 * Flags if we should monitor the hash and change slides accordingly
264 *
265 * @defaultValue true
266 */
267 respondToHashChanges?: boolean;
268 /**
269 * Enable support for jump-to-slide navigation shortcuts
270 *
271 * @defaultValue true
272 */
273 jumpToSlide?: boolean;
274 /**
275 * Push each slide change to the browser history. Implies `hash: true`
276 *
277 * @defaultValue false
278 */
279 history?: boolean;
280 /**
281 * Enable keyboard shortcuts for navigation
282 *
283 * @defaultValue true
284 */
285 keyboard?: boolean | {
286 [keyCode: number]: string | ((event: KeyboardEvent) => void);
287 };
288 /**
289 * Optional function that blocks keyboard events when returning false
290 *
291 * If you set this to 'focused', we will only capture keyboard events
292 * for embedded decks when they are in focus
293 *
294 * @defaultValue null
295 */
296 keyboardCondition?: null | 'focused' | ((event: KeyboardEvent) => boolean);
297 /**
298 * Disables the default reveal.js slide layout (scaling and centering)
299 * so that you can use custom CSS layout
300 *
301 * @defaultValue false
302 */
303 disableLayout?: boolean;
304 /**
305 * Enable the slide overview mode
306 *
307 * @see {@link https://revealjs.com/overview/}
308 *
309 * @defaultValue true
310 */
311 overview?: boolean;
312 /**
313 * Vertical centering of slides
314 *
315 * @defaultValue true
316 */
317 center?: boolean;
318 /**
319 * Enables touch navigation on devices with touch input
320 *
321 * @defaultValue true
322 */
323 touch?: boolean;
324 /**
325 * Loop the presentation
326 *
327 * @defaultValue false
328 */
329 loop?: boolean;
330 /**
331 * Change the presentation direction to be RTL
332 *
333 * @defaultValue false
334 */
335 rtl?: boolean;
336 /**
337 * Changes the behavior of our navigation directions.
338 *
339 * "default"
340 * Left/right arrow keys step between horizontal slides, up/down
341 * arrow keys step between vertical slides. Space key steps through
342 * all slides (both horizontal and vertical).
343 *
344 * "linear"
345 * Removes the up/down arrows. Left/right arrows step through all
346 * slides (both horizontal and vertical).
347 *
348 * "grid"
349 * When this is enabled, stepping left/right from a vertical stack
350 * to an adjacent vertical stack will land you at the same vertical
351 * index.
352 *
353 * Consider a deck with six slides ordered in two vertical stacks:
354 * 1.1 2.1
355 * 1.2 2.2
356 * 1.3 2.3
357 *
358 * If you're on slide 1.3 and navigate right, you will normally move
359 * from 1.3 -> 2.1. If "grid" is used, the same navigation takes you
360 * from 1.3 -> 2.3.
361 *
362 * @defaultValue 'default'
363 */
364 navigationMode?: 'default' | 'linear' | 'grid';
365 /**
366 * Randomizes the order of slides each time the presentation loads
367 *
368 * @defaultValue false
369 */
370 shuffle?: boolean;
371 /**
372 * Turns fragments on and off globally
373 *
374 * @see {@link https://revealjs.com/fragments/}
375 *
376 * @defaultValue true
377 */
378 fragments?: boolean;
379 /**
380 * Flags whether to include the current fragment in the URL,
381 * so that reloading brings you to the same fragment position
382 *
383 * @defaultValue true
384 */
385 fragmentInURL?: boolean;
386 /**
387 * Flags if the presentation is running in an embedded mode,
388 * i.e. contained within a limited portion of the screen
389 *
390 * @defaultValue false
391 */
392 embedded?: boolean;
393 /**
394 * Flags if we should show a help overlay when the question-mark
395 * key is pressed
396 *
397 * @defaultValue true
398 */
399 help?: boolean;
400 /**
401 * Flags if it should be possible to pause the presentation (blackout)
402 *
403 * @defaultValue true
404 */
405 pause?: boolean;
406 /**
407 * Flags if speaker notes should be visible to all viewers
408 *
409 * @defaultValue false
410 */
411 showNotes?: boolean;
412 /**
413 * Flags if slides with data-visibility="hidden" should be kept visible
414 *
415 * @defaultValue false
416 */
417 showHiddenSlides?: boolean;
418 /**
419 * Global override for autoplaying embedded media (video/audio/iframe)
420 * - null: Media will only autoplay if data-autoplay is present
421 * - true: All media will autoplay, regardless of individual setting
422 * - false: No media will autoplay, regardless of individual setting
423 *
424 * @defaultValue null
425 */
426 autoPlayMedia?: null | boolean;
427 /**
428 * Global override for preloading lazy-loaded iframes
429 * - null: Iframes with data-src AND data-preload will be loaded when within
430 * the viewDistance, iframes with only data-src will be loaded when visible
431 * - true: All iframes with data-src will be loaded when within the viewDistance
432 * - false: All iframes with data-src will be loaded only when visible
433 *
434 * @defaultValue null
435 */
436 preloadIframes?: null | boolean;
437 /**
438 * Prevent embedded iframes from automatically focusing on themselves
439 *
440 * @defaultValue false
441 */
442 preventIframeAutoFocus?: boolean;
443 /**
444 * Can be used to globally disable auto-animation
445 *
446 * @see {@link https://revealjs.com/auto-animate/}
447 *
448 * @defaultValue true
449 */
450 autoAnimate?: boolean;
451 /**
452 * Optionally provide a custom element matcher that will be
453 * used to dictate which elements we can animate between.
454 *
455 * @defaultValue null
456 */
457 autoAnimateMatcher?: null | Function;
458 /**
459 * Default settings for our auto-animate transitions, can be
460 * overridden per-slide or per-element via data arguments
461 *
462 * @defaultValue 'ease'
463 */
464 autoAnimateEasing?: 'ease' | string;
465 /**
466 * Number of seconds to animate each element.
467 *
468 * @defaultValue 1.0
469 */
470 autoAnimateDuration?: number;
471 /**
472 * Should unmatched elements be faded in?
473 *
474 * @defaultValue true
475 */
476 autoAnimateUnmatched?: boolean;
477 /**
478 * CSS properties that can be auto-animated. Position & scale
479 * is matched separately so there's no need to include styles
480 * like top/right/bottom/left, width/height or margin.
481 *
482 * @defaultValue ['opacity', 'color', 'background-color', 'padding', 'font-size', 'line-height', 'letter-spacing', 'border-width', 'border-color', 'border-radius', 'outline', 'outline-offset']
483 */
484 autoAnimateStyles?: string[];
485 /**
486 * Controls automatic progression to the next slide
487 * - 0: Auto-sliding only happens if the data-autoslide HTML attribute
488 * is present on the current slide or fragment
489 * - 1+: All slides will progress automatically at the given interval
490 * - false: No auto-sliding, even if data-autoslide is present
491 *
492 * @defaultValue 0
493 */
494 autoSlide?: number | false;
495 /**
496 * Stop auto-sliding after user input
497 *
498 * @defaultValue true
499 */
500 autoSlideStoppable?: boolean;
501 /**
502 * Use this method for navigation when auto-sliding (defaults to navigateNext)
503 *
504 * @defaultValue null
505 */
506 autoSlideMethod?: null | Function;
507 /**
508 * Specify the average time in seconds that you think you will spend
509 * presenting each slide. This is used to show a pacing timer in the
510 * speaker view
511 *
512 * @defaultValue null
513 */
514 defaultTiming?: null;
515 /**
516 * Enable slide navigation via mouse wheel
517 *
518 * @defaultValue false
519 */
520 mouseWheel?: boolean;
521 /**
522 * Opens links in an iframe preview overlay
523 * Add `data-preview-link` and `data-preview-link="false"` to customize each link
524 * individually
525 *
526 * @defaultValue false
527 */
528 previewLinks?: boolean;
529 /**
530 * Exposes the reveal.js API through window.postMessage
531 *
532 * @defaultValue true
533 */
534 postMessage?: boolean;
535 /**
536 * Dispatches all reveal.js events to the parent window through postMessage
537 *
538 * @defaultValue false
539 */
540 postMessageEvents?: boolean;
541 /**
542 * Focuses body when page changes visibility to ensure keyboard shortcuts work
543 *
544 * @defaultValue true
545 */
546 focusBodyOnPageVisibilityChange?: boolean;
547 /**
548 * Transition style
549 *
550 * @see {@link https://revealjs.com/transitions/}
551 *
552 * @defaultValue 'slide'
553 */
554 transition?: TransitionStyle;
555 /**
556 * Transition speed
557 *
558 * @defaultValue 'default'
559 */
560 transitionSpeed?: TransitionSpeed;
561 /**
562 * Transition style for full page slide backgrounds
563 *
564 * @defaultValue 'fade'
565 */
566 backgroundTransition?: TransitionStyle;
567 /**
568 * Parallax background image
569 *
570 * @defaultValue ''
571 */
572 parallaxBackgroundImage?: null | string;
573 /**
574 * Parallax background size
575 *
576 * @defaultValue ''
577 */
578 parallaxBackgroundSize?: null | string;
579 /**
580 * Parallax background repeat
581 *
582 * @defaultValue ''
583 */
584 parallaxBackgroundRepeat?: null | string;
585 /**
586 * Parallax background position
587 *
588 * @defaultValue ''
589 */
590 parallaxBackgroundPosition?: null | string;
591 /**
592 * Amount of pixels to move the parallax background per slide step
593 *
594 * @defaultValue null
595 */
596 parallaxBackgroundHorizontal?: null | number;
597 /**
598 *
599 * @defaultValue null
600 */
601 parallaxBackgroundVertical?: null | number;
602 /**
603 * Can be used to initialize reveal.js in one of the following views:
604 * - print: Render the presentation so that it can be printed to PDF
605 * - scroll: Show the presentation as a tall scrollable page with scroll
606 * triggered animations
607 *
608 * @see {@link https://revealjs.com/scroll-view/}
609 *
610 * @defaultValue null
611 */
612 view?: null | 'print' | 'scroll';
613 /**
614 * Adjusts the height of each slide in the scroll view.
615 * - full: Each slide is as tall as the viewport
616 * - compact: Slides are as small as possible, allowing multiple slides
617 * to be visible in parallel on tall devices
618 *
619 * @defaultValue 'full'
620 */
621 scrollLayout?: 'full' | 'compact';
622 /**
623 * Control how scroll snapping works in the scroll view.
624 * - false: No snapping, scrolling is continuous
625 * - proximity: Snap when close to a slide
626 * - mandatory: Always snap to the closest slide
627 *
628 * Only applies to presentations in scroll view.
629 *
630 * @defaultValue 'mandatory'
631 */
632 scrollSnap?: false | 'proximity' | 'mandatory';
633 /**
634 * Enables and configures the scroll view progress bar.
635 * - 'auto': Show the scrollbar while scrolling, hide while idle
636 * - true: Always show the scrollbar
637 * - false: Never show the scrollbar
638 *
639 * @defaultValue 'auto'
640 */
641 scrollProgress?: 'auto' | boolean;
642 /**
643 * Automatically activate the scroll view when we the viewport falls
644 * below the given width.
645 *
646 * @defaultValue 435
647 */
648 scrollActivationWidth?: number;
649 /**
650 * The maximum number of pages a single slide can expand onto when printing
651 * to PDF, unlimited by default
652 *
653 * @defaultValue Number.POSITIVE_INFINITY
654 */
655 pdfMaxPagesPerSlide?: number;
656 /**
657 * Prints each fragment on a separate slide
658 *
659 * @defaultValue true
660 */
661 pdfSeparateFragments?: boolean;
662 /**
663 * Offset used to reduce the height of content within exported PDF pages.
664 * This exists to account for environment differences based on how you
665 * print to PDF. CLI printing options, like phantomjs and wkpdf, can end
666 * on precisely the total height of the document whereas in-browser
667 * printing has to end one pixel before.
668 *
669 * @defaultValue -1
670 */
671 pdfPageHeightOffset?: number;
672 /**
673 * Number of slides away from the current that are visible
674 *
675 * @defaultValue 3
676 */
677 viewDistance?: number;
678 /**
679 * Number of slides away from the current that are visible on mobile
680 * devices. It is advisable to set this to a lower number than
681 * viewDistance in order to save resources.
682 *
683 * @defaultValue 2
684 */
685 mobileViewDistance?: number;
686 /**
687 * The display mode that will be used to show slides
688 *
689 * @defaultValue 'block'
690 */
691 display?: string;
692 /**
693 * Hide cursor if inactive
694 *
695 * @defaultValue true
696 */
697 hideInactiveCursor?: boolean;
698 /**
699 * Time before the cursor is hidden (in ms)
700 *
701 * @defaultValue 5000
702 */
703 hideCursorTime?: number;
704 /**
705 * Should we automatically sort and set indices for fragments
706 * at each sync? (See Reveal.sync)
707 *
708 * @defaultValue true
709 */
710 sortFragmentsOnSync?: boolean;
711 /**
712 * Highlight plugin configuration
713 */
714 highlight?: HighlightConfig;
715 /**
716 * Markdown plugin configuration
717 */
718 markdown?: MarkdownConfig;
719 /**
720 * KaTeX math plugin configuration
721 */
722 katex?: KatexConfig;
723 /**
724 * MathJax 2 plugin configuration
725 */
726 mathjax2?: Mathjax2Config;
727 /**
728 * MathJax 3 plugin configuration
729 */
730 mathjax3?: Mathjax3Config;
731 /**
732 * MathJax 4 plugin configuration
733 */
734 mathjax4?: Mathjax4Config;
735 /**
736 * Script dependencies to load
737 *
738 * @defaultValue []
739 */
740 dependencies?: any[];
741 /**
742 * Plugin objects to register and use for this presentation
743 *
744 * @defaultValue []
745 */
746 plugins?: any[];
747 }
748 /**
749 * The default reveal.js config object.
750 */
751 declare const defaultConfig: RevealConfig;
752 export type { RevealConfig, TransitionStyle, TransitionSpeed, FragmentAnimation, KatexConfig, Mathjax2Config, Mathjax3Config, Mathjax4Config, HighlightConfig, MarkdownConfig, };
753 export { defaultConfig };
754
754 lines TYPESCRIPT