@farberg/reveal-template 1.1.2 → 1.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/init-reveal.js CHANGED
@@ -10,7 +10,7 @@ import ToggleSolutionsPlugin from './plugins/reveal-plugin-toggle-solutions.js';
10
10
  import DirTreePlugin from './plugins/reveal-plugin-dir-tree.js';
11
11
  import PrefixUrlPlugin from './plugins/reveal-plugin-prefix-with-base-url.js';
12
12
  import AsciinemaPlugin from './plugins/reveal-plugin-asciinema.js';
13
-
13
+ import MermaidPlugin from 'plugins/reveal-plugin-mermaid.js';
14
14
 
15
15
  const defaultOptions = {
16
16
  revealOptions: {},
@@ -46,7 +46,7 @@ const extraThemeCssStylesheets = [
46
46
  const defaultDennisPlugins = [
47
47
  ShowCodeSnippets, ShowToc, ShowAttribution, ShowQrCode, ShowTitle,
48
48
  ModifyFontSize, ShowHTMLExample, ToggleSolutionsPlugin, DirTreePlugin,
49
- PrefixUrlPlugin, AsciinemaPlugin
49
+ PrefixUrlPlugin, AsciinemaPlugin, MermaidPlugin
50
50
  ]
51
51
 
52
52
  const defaultRevealOptions = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@farberg/reveal-template",
3
- "version": "1.1.2",
3
+ "version": "1.1.3",
4
4
  "homepage": "https://github.com/pfisterer/reveal-template",
5
5
  "description": "Reveal.js template for Dennis' lectures",
6
6
  "main": "index.js",
@@ -16,14 +16,14 @@
16
16
  "license": "Apache License 2.0",
17
17
  "dependencies": {
18
18
  "asciinema-player": "^3.9.0",
19
- "easyqrcodejs": "^4.6.1",
19
+ "connect": "^3.7.0",
20
+ "easyqrcodejs": "^4.6.2",
20
21
  "file-saver": "^2.0.5",
21
22
  "jszip": "^3.10.1",
22
- "qrcode": "1.5.4",
23
- "reveal.js": "^5.1.0",
24
- "connect": "^3.7.0",
23
+ "mermaid": "^11.6.0",
25
24
  "pdf-merger-js": "^5.1.2",
26
- "puppeteer": "^24.2.1",
27
- "serve-static": "^1.16.2"
25
+ "puppeteer": "^24.6.0",
26
+ "reveal.js": "^5.2.1",
27
+ "serve-static": "^2.2.0"
28
28
  }
29
- }
29
+ }
@@ -0,0 +1,61 @@
1
+ import mermaid from './node_modules/mermaid/dist/mermaid.esm.min.mjs';
2
+
3
+ export const MermaidPlugin = {
4
+ id: 'mermaid',
5
+ init: (deck) => {
6
+ mermaid.initialize({
7
+ 'startOnLoad': false,
8
+ 'theme': 'base',
9
+ 'themeVariables': {
10
+ 'textColor': '#000',
11
+ 'primaryColor': '#e2001a',
12
+ 'primaryTextColor': '#ffff',
13
+ 'noteBkgColor': '#ededeb',
14
+ 'fontFamily': 'arial',
15
+ 'lineColor': '#5c6971',
16
+ 'primaryBorderColor': '#5c6971',
17
+ 'secondaryColor': '#5c6971',
18
+ 'secondaryTextColor': '#000'
19
+ },
20
+ 'sequence': {
21
+ 'mirrorActors': false,
22
+ 'useMaxWidth': true
23
+ }
24
+ });
25
+
26
+ function handle(el) {
27
+ const mermaids = el.querySelectorAll('pre.mermaid')
28
+ mermaid.run({
29
+ nodes: mermaids,
30
+ });
31
+ }
32
+
33
+ deck.on('ready', event => {
34
+ const style = document.createElement("style");
35
+ style.innerHTML = `
36
+ pre.mermaid {
37
+ all: revert;
38
+ padding: 10px;
39
+ border-radius: 10px;
40
+ border: 1px solid #e0e0e0;
41
+ box-shadow: none !important;
42
+ text-align: center;
43
+ }
44
+ `;
45
+ document.head.appendChild(style);
46
+
47
+ //check if url contains print-pdf
48
+
49
+ const print = window.location.search.match(/print-pdf/gi);
50
+
51
+ if (print) {
52
+ console.log("print-pdf detected, rendering mermaid diagrams")
53
+ handle(document);
54
+ } else {
55
+ deck.addEventListener('slidechanged', e => handle(e.currentSlide));
56
+ handle(event.currentSlide);
57
+ }
58
+
59
+ })
60
+ }
61
+ }