@farberg/reveal-template 1.1.9 → 1.1.12

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
@@ -77,7 +77,16 @@ const defaultRevealOptions = {
77
77
  boardmarkerWidth: 2,
78
78
  chalkWidth: 3,
79
79
  chalkEffect: 0.4,
80
- theme: "chalkboard" // or "whiteboard"
80
+ theme: "chalkboard", // or "whiteboard"
81
+ grid: { color: 'rgb(50,50,10,0.5)', distance: 100, width: 3 },
82
+ boardmarkers: [
83
+ { color: 'rgba(225, 2, 23, 1)' },
84
+ { color: 'rgba(100,100,100,1)' },
85
+ ],
86
+ chalks: [
87
+ { color: 'rgba(225, 2, 23, 0.6)' },
88
+ { color: 'rgba(100,100,100,0.6)' },
89
+ ]
81
90
  },
82
91
  keyboard: {
83
92
  33: function () { Reveal.left(); }, // Don't go up using the presenter
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@farberg/reveal-template",
3
- "version": "1.1.9",
3
+ "version": "1.1.12",
4
4
  "homepage": "https://github.com/pfisterer/reveal-template",
5
5
  "description": "Reveal.js template for Dennis' lectures",
6
6
  "main": "index.js",
@@ -15,17 +15,17 @@
15
15
  "author": "Dennis Pfisterer, http://dennis-pfisterer.de",
16
16
  "license": "Apache License 2.0",
17
17
  "dependencies": {
18
- "asciinema-player": "^3.9.0",
18
+ "asciinema-player": "^3.15.1",
19
19
  "connect": "^3.7.0",
20
20
  "easyqrcodejs": "^4.6.2",
21
21
  "file-saver": "^2.0.5",
22
22
  "jszip": "^3.10.1",
23
- "mermaid": "^11.6.0",
23
+ "mermaid": "^11.14.0",
24
24
  "pdf-merger-js": "^5.1.2",
25
- "puppeteer": "^24.6.0",
26
- "reveal.js": "^5.2.1",
27
- "serve-static": "^2.2.0",
28
- "@fortawesome/fontawesome-free": "^6.4.1",
25
+ "puppeteer": "^24.42.0",
26
+ "reveal.js": "^6.0.1",
27
+ "serve-static": "^2.2.1",
28
+ "@fortawesome/fontawesome-free": "^7.2.0",
29
29
  "reveal.js-plugins": "^4.6.0"
30
30
  }
31
31
  }
@@ -57,15 +57,24 @@ const dir_tree = {
57
57
  }
58
58
 
59
59
  function download(files, zipName) {
60
- Promise.all(files.map(file => fetch(file)))
61
- .then(promises => Promise.all(promises.map(p => p.text()))
62
- .then(values => {
63
- var zip = new JSZip();
64
- values.forEach((text, idx) => zip.file(files[idx], text))
65
- zip.generateAsync({ type: "blob" }).then(blob => {
66
- saveAs(blob, zipName);
60
+ Promise.all(files.map(file => fetch(file, { "credentials": "include" })))
61
+ .then(promises => {
62
+ // Check for 401 responses
63
+ const hasUnauthorized = promises.some(p => p.status === 401);
64
+ if (hasUnauthorized) {
65
+ console.log("Authentication required (dir-tree), reloading page");
66
+ window.location.reload();
67
+ return;
68
+ }
69
+ return Promise.all(promises.map(p => p.text()))
70
+ .then(values => {
71
+ var zip = new JSZip();
72
+ values.forEach((text, idx) => zip.file(files[idx], text))
73
+ zip.generateAsync({ type: "blob" }).then(blob => {
74
+ saveAs(blob, zipName);
75
+ })
67
76
  })
68
- }))
77
+ })
69
78
 
70
79
  }
71
80
 
@@ -20,14 +20,41 @@ export default {
20
20
  'sequence': {
21
21
  'mirrorActors': false,
22
22
  'useMaxWidth': true
23
+ },
24
+ 'flowchart': {
25
+ 'useMaxWidth': true,
26
+ 'htmlLabels': true
23
27
  }
24
28
  });
25
29
 
30
+ function fixSvgScaling(el) {
31
+ el.querySelectorAll('pre.mermaid svg').forEach(svg => {
32
+ // mermaid v10+ sets style="max-width: Xpx" which constrains width —
33
+ // remove it and let the container CSS drive the size instead
34
+ svg.style.maxWidth = '100%';
35
+ svg.style.width = '100%';
36
+ svg.style.height = 'auto';
37
+ });
38
+ }
39
+
26
40
  function handle(el) {
27
- const mermaids = el.querySelectorAll('pre.mermaid')
28
- mermaid.run({
29
- nodes: mermaids,
41
+ // Convert ```mermaid code blocks into pre.mermaid elements.
42
+ // highlight.js processes them first (adding spans, encoding arrows as >),
43
+ // so we read textContent to strip spans and decode HTML entities back to raw source.
44
+ el.querySelectorAll('code.mermaid').forEach(code => {
45
+ if (code.closest('pre.mermaid')) return; // already converted
46
+ const pre = code.parentElement;
47
+ pre.className = 'mermaid';
48
+ pre.textContent = code.textContent;
30
49
  });
50
+
51
+ const mermaids = el.querySelectorAll('pre.mermaid');
52
+ const result = mermaid.run({ nodes: mermaids });
53
+ if (result && typeof result.then === 'function') {
54
+ result.then(() => fixSvgScaling(el));
55
+ } else {
56
+ setTimeout(() => fixSvgScaling(el), 100);
57
+ }
31
58
  }
32
59
 
33
60
  deck.on('ready', event => {
@@ -40,12 +67,15 @@ export default {
40
67
  border: 1px solid #e0e0e0;
41
68
  box-shadow: none !important;
42
69
  text-align: center;
43
- }
70
+ overflow: visible;
71
+ }
72
+ pre.mermaid svg {
73
+ max-width: 100%;
74
+ height: auto;
75
+ }
44
76
  `;
45
77
  document.head.appendChild(style);
46
78
 
47
- //check if url contains print-pdf
48
-
49
79
  const print = window.location.search.match(/print-pdf/gi);
50
80
 
51
81
  if (print) {
@@ -55,7 +85,6 @@ export default {
55
85
  deck.addEventListener('slidechanged', e => handle(e.currentSlide));
56
86
  handle(event.currentSlide);
57
87
  }
58
-
59
88
  })
60
89
  }
61
90
  }
@@ -93,7 +93,12 @@ export default () => {
93
93
  //console.log(`language = ${language}, url = ${url}, beginMarker = ${beginMarker}, endMarker = ${endMarker}, showLink = ${showLink} `)
94
94
 
95
95
  if (url) {
96
- const response = await fetch(url, { "cache": "no-store" })
96
+ const response = await fetch(url, { "cache": "no-store", "credentials": "include" })
97
+ if (response.status === 401) {
98
+ console.log("Authentication required (show-code-snippets), reloading page");
99
+ window.location.reload();
100
+ return;
101
+ }
97
102
  const text = await response.text()
98
103
  let code = extractBeginEndSnippet(text, beginMarker, endMarker)
99
104
 
@@ -50,9 +50,18 @@ export default () => {
50
50
  deck.on('ready', () => {
51
51
  let info_json_url = (deck.getConfig().farberg_reveal_template || {}).info_json || new URL('package.json', window.location)
52
52
  if (info_json_url)
53
- fetch(info_json_url.href, { "cache": "no-store" })
54
- .then(res => res.json())
55
- .then(json => showLinkToSlidesAndQrCode(deck, json.homepage))
53
+ fetch(info_json_url.href, { "cache": "no-store", "credentials": "include" })
54
+ .then(res => {
55
+ if (res.status === 401) {
56
+ console.log("Authentication required, reloading page");
57
+ window.location.reload();
58
+ return;
59
+ }
60
+ return res.json();
61
+ })
62
+ .then(json => {
63
+ if (json) showLinkToSlidesAndQrCode(deck, json.homepage)
64
+ })
56
65
  .catch(err => console.log("Error fetching info json", err))
57
66
  else
58
67
  console.log("show_qr_code: no URL available @ farberg_reveal_template.info_json")
@@ -53,9 +53,18 @@ export default () => {
53
53
  deck.on('ready', () => {
54
54
  let info_json_url = (deck.getConfig().farberg_reveal_template || {}).info_json || new URL('package.json', window.location)
55
55
  if (info_json_url)
56
- fetch(info_json_url.href, { "cache": "no-store" })
57
- .then(response => response.json())
58
- .then(packageJson => showTitle(deck, packageJson));
56
+ fetch(info_json_url.href, { "cache": "no-store", "credentials": "include" })
57
+ .then(res => {
58
+ if (res.status === 401) {
59
+ console.log("Authentication required (show-title), reloading page");
60
+ window.location.reload();
61
+ return;
62
+ }
63
+ return res.json();
64
+ })
65
+ .then(packageJson => {
66
+ if (packageJson) showTitle(deck, packageJson)
67
+ });
59
68
  else
60
69
  console.log("show_title: no URL available @ farberg_reveal_template.info_json")
61
70
  })
@@ -14,9 +14,18 @@
14
14
  */
15
15
 
16
16
  function showToc(url, el) {
17
- fetch(url, { "cache": "no-store" })
18
- .then(res => res.text())
19
- .then(html => el.innerHTML = html)
17
+ fetch(url, { "cache": "no-store", "credentials": "include" })
18
+ .then(res => {
19
+ if (res.status === 401) {
20
+ console.log("Authentication required (show-toc), reloading page");
21
+ window.location.reload();
22
+ return;
23
+ }
24
+ return res.text();
25
+ })
26
+ .then(html => {
27
+ if (html) el.innerHTML = html
28
+ })
20
29
  .catch(e => console.log(`Unable to load TOC from ${url}`, e))
21
30
  }
22
31
 
@@ -2,12 +2,15 @@ const fs = require('fs');
2
2
 
3
3
  module.exports.combined_pdf = function (package_json) {
4
4
 
5
+ // Extract shortnames and join with " and "
5
6
  let authorBlock = package_json.authors.map(entry => {
6
7
  return entry.shortname || entry.name || "unknown"
7
8
  }).join(" and ")
8
9
 
9
- const combined_pdf_name = `${package_json.description} - ${authorBlock}`
10
- .replace(/[^\w- ]/gi, '') + ".pdf"
10
+ // Match the bash logic: Title - Shortnames.pdf
11
+ // Note: We avoid the regex replacement unless you specifically want
12
+ // to strip the " - " separator we just added.
13
+ const combined_pdf_name = `${package_json.title} - ${authorBlock}.pdf`
11
14
 
12
15
  return combined_pdf_name
13
16
  }