@farberg/reveal-template 1.1.1 → 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 +5 -5
- package/package.json +8 -9
- package/plugins/reveal-plugin-mermaid.js +61 -0
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: {},
|
|
@@ -27,14 +27,14 @@ const externalJsLibs = [
|
|
|
27
27
|
'node_modules/easyqrcodejs/dist/easy.qrcode.min.js',
|
|
28
28
|
'node_modules/file-saver/dist/FileSaver.min.js',
|
|
29
29
|
'node_modules/jszip/dist/jszip.min.js',
|
|
30
|
-
'node_modules/reveal.js-plugins/chalkboard/plugin.js',
|
|
30
|
+
//'node_modules/reveal.js-plugins/chalkboard/plugin.js',
|
|
31
31
|
'node_modules/asciinema-player/dist/bundle/asciinema-player.min.js'
|
|
32
32
|
]
|
|
33
33
|
|
|
34
34
|
const extraStylesheets = [
|
|
35
35
|
{ href: 'node_modules/reveal.js/dist/reveal.css' },
|
|
36
36
|
{ href: 'node_modules/reveal.js/plugin/highlight/zenburn.css' },
|
|
37
|
-
{ href: 'node_modules/reveal.js-plugins/chalkboard/style.css' },
|
|
37
|
+
//{ href: 'node_modules/reveal.js-plugins/chalkboard/style.css' },
|
|
38
38
|
{ href: 'node_modules/asciinema-player/dist/bundle/asciinema-player.css' }
|
|
39
39
|
]
|
|
40
40
|
|
|
@@ -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 = {
|
|
@@ -210,7 +210,7 @@ export function initReveal(opts) {
|
|
|
210
210
|
finalOptions.plugins = [
|
|
211
211
|
...modules,
|
|
212
212
|
...defaultDennisPlugins,
|
|
213
|
-
window.RevealChalkboard,
|
|
213
|
+
//window.RevealChalkboard,
|
|
214
214
|
...finalOptions.plugins
|
|
215
215
|
]
|
|
216
216
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@farberg/reveal-template",
|
|
3
|
-
"version": "1.1.
|
|
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,15 +16,14 @@
|
|
|
16
16
|
"license": "Apache License 2.0",
|
|
17
17
|
"dependencies": {
|
|
18
18
|
"asciinema-player": "^3.9.0",
|
|
19
|
-
"
|
|
19
|
+
"connect": "^3.7.0",
|
|
20
|
+
"easyqrcodejs": "^4.6.2",
|
|
20
21
|
"file-saver": "^2.0.5",
|
|
21
22
|
"jszip": "^3.10.1",
|
|
22
|
-
"
|
|
23
|
-
"reveal.js": "^5.1.0",
|
|
24
|
-
"reveal.js-plugins": "^4.2.5",
|
|
25
|
-
"connect": "^3.7.0",
|
|
23
|
+
"mermaid": "^11.6.0",
|
|
26
24
|
"pdf-merger-js": "^5.1.2",
|
|
27
|
-
"puppeteer": "^24.
|
|
28
|
-
"
|
|
25
|
+
"puppeteer": "^24.6.0",
|
|
26
|
+
"reveal.js": "^5.2.1",
|
|
27
|
+
"serve-static": "^2.2.0"
|
|
29
28
|
}
|
|
30
|
-
}
|
|
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
|
+
}
|