@farberg/reveal-template 1.1.36 → 1.1.38
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/css/dhbw.css
CHANGED
|
@@ -283,7 +283,7 @@ body {
|
|
|
283
283
|
border-collapse: collapse;
|
|
284
284
|
border-spacing: 0;
|
|
285
285
|
font-size: 70%;
|
|
286
|
-
|
|
286
|
+
border: 1px solid #d0d0d0;
|
|
287
287
|
}
|
|
288
288
|
|
|
289
289
|
.reveal table th {
|
|
@@ -293,7 +293,13 @@ body {
|
|
|
293
293
|
.reveal table th, .reveal table td {
|
|
294
294
|
text-align: left;
|
|
295
295
|
padding: 0.2em 0.5em 0.2em 0.5em;
|
|
296
|
-
border
|
|
296
|
+
border: 1px solid #d0d0d0;
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
/* Zebra striping: alternating white / very light grey rows.
|
|
300
|
+
The toc_table has its own border/background rules, so exclude it. */
|
|
301
|
+
.reveal table:not(.toc_table) tbody tr:nth-child(even) {
|
|
302
|
+
background-color: #fbfbfb;
|
|
297
303
|
}
|
|
298
304
|
|
|
299
305
|
.reveal table th[align="center"], .reveal table td[align="center"] {
|
|
@@ -304,10 +310,6 @@ body {
|
|
|
304
310
|
text-align: right;
|
|
305
311
|
}
|
|
306
312
|
|
|
307
|
-
.reveal table tr:last-child td {
|
|
308
|
-
border-bottom: none;
|
|
309
|
-
}
|
|
310
|
-
|
|
311
313
|
.reveal sup {
|
|
312
314
|
vertical-align: super;
|
|
313
315
|
}
|
|
@@ -19,21 +19,35 @@ kubectl apply -f https://raw.githubusercontent.com/strimzi/strimzi-kafka-operato
|
|
|
19
19
|
docker buildx build --platform linux/amd64,linux/arm64,linux/arm/v7 -t yourusername/yourcontainername:1.2.3 -t yourusername/yourcontainername:latest --push .
|
|
20
20
|
```
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
```bash
|
|
23
|
+
docker buildx build --platform linux/amd64,linux/arm64,linux/arm/v7 -t yourusername/yourcontainername:1.2.3 -t yourusername/yourcontainername:latest --push .
|
|
24
|
+
```
|
|
25
|
+
<!-- .element: data-no-wrap -->
|
|
23
26
|
|
|
24
27
|
---
|
|
25
28
|
## Kafka Streams: Run It
|
|
26
29
|
|
|
27
30
|
<pre class="dirtree" data-zipname="bla.zip" style="margin-left: 40px;">
|
|
28
31
|
00 - Introduction.md
|
|
29
|
-
|
|
32
|
+
test-code.c
|
|
30
33
|
</pre>
|
|
31
34
|
|
|
32
35
|
<pre class="dirtree" style="margin-left: 40px;">
|
|
33
36
|
00 - Introduction.md
|
|
34
|
-
|
|
37
|
+
test-code.c
|
|
35
38
|
</pre>
|
|
36
39
|
|
|
40
|
+
---
|
|
41
|
+
# Table
|
|
42
|
+
|
|
43
|
+
| Name | Description |
|
|
44
|
+
| ------------ | ----------------------------------------------------------------------- |
|
|
45
|
+
| File sink | Stores the output to a directory |
|
|
46
|
+
| Kafka sink | Stores the output to one or more topics in Kafka |
|
|
47
|
+
| Foreach sink | Runs arbitrary computation on each record |
|
|
48
|
+
| Console sink | Prints to stdout (debug only, collects data in driver program) |
|
|
49
|
+
| Memory sink | Stored as in-memory table (debug only, collects data in driver program) |
|
|
50
|
+
|
|
37
51
|
---
|
|
38
52
|
## Mermaid Example
|
|
39
53
|
|
package/docs/test-code.c
ADDED
package/package.json
CHANGED
|
@@ -486,8 +486,12 @@ const dirTreeFactory = ({ zip, strToU8 }) => ({
|
|
|
486
486
|
let modalRefs = null;
|
|
487
487
|
|
|
488
488
|
// View preferences persist across previews within a session.
|
|
489
|
-
|
|
490
|
-
|
|
489
|
+
// FONT_FIT_MAX caps the automatic enlarge-to-fit for small files so a
|
|
490
|
+
// two-line file does not blow up to an absurd size; manual A+ can still
|
|
491
|
+
// climb to FONT_MAX.
|
|
492
|
+
const FONT_MIN = 11, FONT_MAX = 32, FONT_FIT_MAX = 28, FONT_STEP = 2;
|
|
493
|
+
const FONT_BASE = 16;
|
|
494
|
+
let previewFontPx = FONT_BASE;
|
|
491
495
|
let previewTheme = 'light'; // 'light' | 'dark'
|
|
492
496
|
|
|
493
497
|
function ensureModal() {
|
|
@@ -523,6 +527,32 @@ const dirTreeFactory = ({ zip, strToU8 }) => ({
|
|
|
523
527
|
themeBtn.textContent = previewTheme === 'dark' ? '☀ light' : '🌙 dark';
|
|
524
528
|
}
|
|
525
529
|
|
|
530
|
+
// Small files render a few short lines of fixed-size text marooned in a
|
|
531
|
+
// big modal, which reads as "tiny font in an undersized window". Scale
|
|
532
|
+
// the font UP so the content fills the available width/height — but only
|
|
533
|
+
// up (scale > 1), so large files that already fill the modal keep their
|
|
534
|
+
// comfortable base size. Measured at FONT_BASE, then capped at
|
|
535
|
+
// FONT_FIT_MAX so a two-liner doesn't balloon. Sets previewFontPx so the
|
|
536
|
+
// A−/A+ buttons continue from the fitted size.
|
|
537
|
+
function fitFontToContent() {
|
|
538
|
+
code.style.fontSize = FONT_BASE + 'px';
|
|
539
|
+
// scrollWidth/Height force a layout read of the content's natural size
|
|
540
|
+
// (white-space:pre means width is the longest line).
|
|
541
|
+
const contentW = code.scrollWidth;
|
|
542
|
+
const contentH = code.scrollHeight;
|
|
543
|
+
if (!contentW || !contentH) { applyView(); return; }
|
|
544
|
+
// Available space: body width is the modal's fixed width; for height
|
|
545
|
+
// the modal grows with content, so derive the ceiling from the
|
|
546
|
+
// viewport (overlay is fixed inset:0) minus the header, matching the
|
|
547
|
+
// modal's max-height:92vh with a little slack.
|
|
548
|
+
const availW = body.clientWidth;
|
|
549
|
+
const availH = overlay.clientHeight * 0.9 - header.offsetHeight;
|
|
550
|
+
const scale = Math.min(availW / contentW, availH / contentH);
|
|
551
|
+
if (scale > 1)
|
|
552
|
+
previewFontPx = Math.min(FONT_FIT_MAX, Math.floor(FONT_BASE * scale));
|
|
553
|
+
applyView();
|
|
554
|
+
}
|
|
555
|
+
|
|
526
556
|
const fontDecBtn = document.createElement('button');
|
|
527
557
|
fontDecBtn.classList.add('dirtree-modal-btn');
|
|
528
558
|
fontDecBtn.title = 'Decrease font size';
|
|
@@ -599,13 +629,16 @@ const dirTreeFactory = ({ zip, strToU8 }) => ({
|
|
|
599
629
|
|
|
600
630
|
applyView(); // initialise font-size, theme class and toggle label
|
|
601
631
|
|
|
602
|
-
modalRefs = { overlay, title, code, body, close, applyView };
|
|
632
|
+
modalRefs = { overlay, title, code, body, close, applyView, fitFontToContent };
|
|
603
633
|
return modalRefs;
|
|
604
634
|
}
|
|
605
635
|
|
|
606
636
|
function openPreview(filePath, fileName, ext) {
|
|
607
|
-
const { overlay, title, code, body, applyView } = ensureModal();
|
|
637
|
+
const { overlay, title, code, body, applyView, fitFontToContent } = ensureModal();
|
|
608
638
|
title.textContent = fileName;
|
|
639
|
+
// Re-fit each file from the base size rather than carrying over the last
|
|
640
|
+
// file's fitted size.
|
|
641
|
+
previewFontPx = FONT_BASE;
|
|
609
642
|
code.textContent = 'Loading…';
|
|
610
643
|
// Reset highlight state so the reused element can be re-highlighted.
|
|
611
644
|
code.removeAttribute('class');
|
|
@@ -631,6 +664,8 @@ const dirTreeFactory = ({ zip, strToU8 }) => ({
|
|
|
631
664
|
if (lang) code.classList.add('language-' + lang);
|
|
632
665
|
try { hljs.highlightElement(code); } catch (e) { /* leave as plain text */ }
|
|
633
666
|
}
|
|
667
|
+
// Enlarge small files to fill the modal (no-op for large files).
|
|
668
|
+
fitFontToContent();
|
|
634
669
|
})
|
|
635
670
|
.catch(err => { code.textContent = 'Failed to load file: ' + err.message; });
|
|
636
671
|
}
|
|
@@ -7,6 +7,15 @@ Parameters:
|
|
|
7
7
|
- data-begin-nth: Start after the Nth occurrence of data-begin instead of the first (optional, 1-based)
|
|
8
8
|
- data-end: End indicator in the file (optional)
|
|
9
9
|
- data-link: Show a link to the file (optional)
|
|
10
|
+
- data-no-wrap: Disable soft line wrapping; long lines scroll horizontally instead (optional)
|
|
11
|
+
|
|
12
|
+
For inline markdown code fences, disable wrapping with a no-wrap class or a
|
|
13
|
+
data-no-wrap attribute via reveal's element-attribute comment, e.g.
|
|
14
|
+
|
|
15
|
+
```console
|
|
16
|
+
199.72.81.55 - - [01/Jul/1995:00:00:01 -0400] "GET /history/apollo/ HTTP/1.0" 200 6245
|
|
17
|
+
```
|
|
18
|
+
<!-- .element: class="no-wrap" -->
|
|
10
19
|
|
|
11
20
|
Example
|
|
12
21
|
|
|
@@ -98,6 +107,20 @@ function injectStyles() {
|
|
|
98
107
|
overflow-wrap: break-word;
|
|
99
108
|
word-break: normal;
|
|
100
109
|
}
|
|
110
|
+
/* Opt-out: with data-no-wrap (or a "no-wrap" class on the <pre>) long lines
|
|
111
|
+
are kept on one line and the block scrolls horizontally instead. These
|
|
112
|
+
blocks are never run through wrapCodeLines/decorateWrappedLines, so the
|
|
113
|
+
.cl hang-indent and wrap markers above never apply to them. Declared
|
|
114
|
+
after the wrapping rules so equal-specificity selectors win on order. */
|
|
115
|
+
.reveal pre.with-copy-btn.no-wrap,
|
|
116
|
+
.reveal pre.with-copy-btn.no-wrap code {
|
|
117
|
+
white-space: pre;
|
|
118
|
+
overflow-wrap: normal;
|
|
119
|
+
word-break: normal;
|
|
120
|
+
}
|
|
121
|
+
.reveal pre.with-copy-btn.no-wrap {
|
|
122
|
+
overflow-x: auto;
|
|
123
|
+
}
|
|
101
124
|
/* Each logical source line becomes its own block so wrapped continuation
|
|
102
125
|
rows can be hang-indented (text-indent pulls the first row back to the
|
|
103
126
|
margin; padding-left indents everything else). padding-right reserves
|
|
@@ -328,7 +351,14 @@ export default () => {
|
|
|
328
351
|
// Capture raw source before highlighting/line-wrapping touches the DOM.
|
|
329
352
|
if (pre) pre.__rawCode = el.textContent
|
|
330
353
|
highlightPlugin.hljs.highlightElement(el);
|
|
331
|
-
|
|
354
|
+
// Opt-out authored on the <pre> or <code> — either a "no-wrap"
|
|
355
|
+
// class or a data-no-wrap attribute. Reveal's markdown
|
|
356
|
+
// `<!-- .element: ... -->` may land the attribute on either
|
|
357
|
+
// element, so check both.
|
|
358
|
+
const optOut = n => n && (n.classList.contains('no-wrap') || n.hasAttribute('data-no-wrap'))
|
|
359
|
+
const noWrap = optOut(pre) || optOut(el)
|
|
360
|
+
if (noWrap) pre && pre.classList.add('no-wrap')
|
|
361
|
+
else wrapCodeLines(el);
|
|
332
362
|
addCopyButton(pre);
|
|
333
363
|
}
|
|
334
364
|
}
|
|
@@ -342,6 +372,7 @@ export default () => {
|
|
|
342
372
|
let endMarker = el.getAttribute("data-end")
|
|
343
373
|
let showLink = el.hasAttribute("data-link")
|
|
344
374
|
let outdentCode = el.hasAttribute("data-outdent")
|
|
375
|
+
let noWrap = el.hasAttribute("data-no-wrap")
|
|
345
376
|
|
|
346
377
|
//console.log(`language = ${language}, url = ${url}, beginMarker = ${beginMarker}, endMarker = ${endMarker}, showLink = ${showLink} `)
|
|
347
378
|
|
|
@@ -377,7 +408,8 @@ export default () => {
|
|
|
377
408
|
if (language !== 'mermaid') {
|
|
378
409
|
const codeEl = newEl.querySelector('code') ?? newEl
|
|
379
410
|
highlightPlugin.hljs.highlightElement(codeEl)
|
|
380
|
-
|
|
411
|
+
if (noWrap) newEl.classList.add('no-wrap')
|
|
412
|
+
else wrapCodeLines(codeEl)
|
|
381
413
|
addCopyButton(newEl)
|
|
382
414
|
}
|
|
383
415
|
} catch (err) {
|