| 1 | import Reveal, { |
| 2 | type MarkdownConfig, |
| 3 | type Mathjax4Config, |
| 4 | type RevealApi, |
| 5 | type RevealConfig, |
| 6 | type RevealPlugin, |
| 7 | type RevealPluginFactory, |
| 8 | } from 'reveal.js'; |
| 9 | import RevealHighlight from 'reveal.js/plugin/highlight'; |
| 10 | import RevealMarkdown from 'reveal.js/plugin/markdown'; |
| 11 | import RevealMath from 'reveal.js/plugin/math'; |
| 12 | import RevealNotes from 'reveal.js/plugin/notes'; |
| 13 | import RevealSearch from 'reveal.js/plugin/search'; |
| 14 | import RevealZoom from 'reveal.js/plugin/zoom'; |
| 15 | |
| 16 | type RevealModule = typeof Reveal; |
| 17 | const revealModule: RevealModule = Reveal; |
| 18 | |
| 19 | const api: RevealApi | null = null; |
| 20 | const pluginFactory: RevealPluginFactory = RevealZoom; |
| 21 | const plugins: Array<RevealPlugin | RevealPluginFactory> = [RevealHighlight(), RevealMarkdown(), RevealMath, RevealNotes, RevealSearch, RevealZoom]; |
| 22 | const markdownConfig: MarkdownConfig = { |
| 23 | separator: '\\n---\\n', |
| 24 | }; |
| 25 | const mathjax4Config: Mathjax4Config = { |
| 26 | tex: { |
| 27 | inlineMath: [['$', '$']], |
| 28 | displayMath: [['$$', '$$']], |
| 29 | macros: { |
| 30 | R: '\\mathbb{R}', |
| 31 | set: ['\\left\\{#1 \\; ; \\; #2\\right\\}', 2], |
| 32 | }, |
| 33 | }, |
| 34 | options: { |
| 35 | skipHtmlTags: ['script', 'style'], |
| 36 | }, |
| 37 | output: { |
| 38 | font: 'mathjax-stix2', |
| 39 | displayOverflow: 'linebreak', |
| 40 | linebreaks: { |
| 41 | inline: true, |
| 42 | width: '100%', |
| 43 | lineleading: 0.2, |
| 44 | }, |
| 45 | }, |
| 46 | }; |
| 47 | const revealConfig: RevealConfig = { |
| 48 | markdown: markdownConfig, |
| 49 | mathjax4: mathjax4Config, |
| 50 | }; |
| 51 | |
| 52 | const highlight = RevealHighlight(); |
| 53 | const highlightId: string = highlight.id; |
| 54 | const highlightSteps = highlight.deserializeHighlightSteps('1,3-5|8'); |
| 55 | const highlightSerialized: string = highlight.serializeHighlightSteps(highlightSteps); |
| 56 | const highlightBounds = highlight.getHighlightedLineBounds(document.createElement('code')); |
| 57 | highlight.highlightLines(document.createElement('code'), '1-2'); |
| 58 | |
| 59 | const markdown = RevealMarkdown(); |
| 60 | const markdownId: string = markdown.id; |
| 61 | const markdownHtml: string = markdown.slidify('# Slide'); |
| 62 | const markdownPromise: Promise<void[]> = markdown.processSlides(document); |
| 63 | const convertPromise: Promise<void> = markdown.convertSlides(); |
| 64 | const markdownOptions = markdown.markdownOptions; |
| 65 | |
| 66 | const math = RevealMath; |
| 67 | const mathId: 'mathjax2' = math.id; |
| 68 | const mathJax4Id: 'mathjax4' = math.MathJax4().id; |
| 69 | const katexId: 'katex' = math.KaTeX().id; |
| 70 | |
| 71 | const notes = RevealNotes(); |
| 72 | const notesId: 'notes' = notes.id; |
| 73 | notes.open(); |
| 74 | |
| 75 | const search = RevealSearch(); |
| 76 | const searchId: 'search' = search.id; |
| 77 | search.open(); |
| 78 | search.close(); |
| 79 | search.toggle(); |
| 80 | |
| 81 | const zoom = RevealZoom(); |
| 82 | const zoomId: 'zoom' = zoom.id; |
| 83 | |
| 84 | void highlightId; |
| 85 | void highlightSteps; |
| 86 | void highlightSerialized; |
| 87 | void highlightBounds; |
| 88 | void markdownId; |
| 89 | void markdownHtml; |
| 90 | void markdownPromise; |
| 91 | void convertPromise; |
| 92 | void markdownOptions; |
| 93 | void mathId; |
| 94 | void mathJax4Id; |
| 95 | void katexId; |
| 96 | void notesId; |
| 97 | void searchId; |
| 98 | void zoomId; |
| 99 | void api; |
| 100 | void pluginFactory; |
| 101 | void plugins; |
| 102 | void markdownConfig; |
| 103 | void mathjax4Config; |
| 104 | void revealConfig; |
| 105 | void revealModule; |
| 106 |