@farberg/reveal-template 1.1.31 → 1.1.32

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.
@@ -15,6 +15,10 @@
15
15
  kubectl apply -f https://raw.githubusercontent.com/strimzi/strimzi-kafka-operator/refs/heads/main/examples/kafka/kafka-ephemeral.yaml
16
16
  ```
17
17
 
18
+ ```bash
19
+ docker buildx build --platform linux/amd64,linux/arm64,linux/arm/v7 -t yourusername/yourcontainername:1.2.3 -t yourusername/yourcontainername:latest --push .
20
+ ```
21
+
18
22
  ---
19
23
  ## Mermaid Example
20
24
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@farberg/reveal-template",
3
- "version": "1.1.31",
3
+ "version": "1.1.32",
4
4
  "homepage": "https://github.com/pfisterer/reveal-template",
5
5
  "description": "Reveal.js template for Dennis' lectures",
6
6
  "main": "index.js",
@@ -87,22 +87,28 @@ function injectStyles() {
87
87
  }
88
88
  /* Soft-wrap long lines like VS Code's word wrap. white-space:pre-wrap is
89
89
  a purely visual wrap: it does NOT insert real newlines into the text.
90
- overflow-wrap:anywhere lets very long tokens / URLs break instead of
91
- overflowing the slide. Copy fidelity is handled separately (see
90
+ overflow-wrap:break-word prefers breaking at whitespace and only splits a
91
+ word when that single token is itself too long to fit (long URLs / base64
92
+ / paths). Unlike "anywhere", it does not snap mid-word when a whitespace
93
+ break is available. Copy fidelity is handled separately (see
92
94
  addCopyButton / wrapCodeLines), so wrapping never leaks into copied text. */
93
95
  .reveal pre.with-copy-btn,
94
96
  .reveal pre.with-copy-btn code {
95
97
  white-space: pre-wrap;
96
- overflow-wrap: anywhere;
98
+ overflow-wrap: break-word;
97
99
  word-break: normal;
98
100
  }
99
101
  /* Each logical source line becomes its own block so wrapped continuation
100
102
  rows can be hang-indented (text-indent pulls the first row back to the
101
- margin; padding-left indents everything else). */
103
+ margin; padding-left indents everything else). padding-right reserves
104
+ room for the end-of-row wrap marker (see decorateWrappedLines): text
105
+ wraps before that zone, so the absolutely-positioned marker lands inside
106
+ the box instead of overflowing and triggering a horizontal scrollbar. */
102
107
  .reveal pre.with-copy-btn code .cl {
103
108
  display: block;
104
109
  position: relative;
105
110
  padding-left: 2.5ch;
111
+ padding-right: 1.5ch;
106
112
  text-indent: -2.5ch;
107
113
  }
108
114
  /* Preserve the height of blank lines. Generated content is excluded from
@@ -110,11 +116,11 @@ function injectStyles() {
110
116
  .reveal pre.with-copy-btn code .cl:empty::before {
111
117
  content: "\\200b";
112
118
  }
113
- /* Continuation marker placed at each soft-wrap point (see wrapCodeLines).
114
- user-select:none keeps it out of native select+copy. */
119
+ /* Continuation marker placed at the end of each row that soft-wraps (see
120
+ decorateWrappedLines). The horizontal/vertical offset is set inline per
121
+ row; user-select:none keeps it out of native select+copy. */
115
122
  .reveal pre.with-copy-btn code .wrap-marker {
116
123
  position: absolute;
117
- left: 0;
118
124
  text-indent: 0;
119
125
  font-style: normal;
120
126
  opacity: 0.4;
@@ -192,10 +198,11 @@ function wrapCodeLines(codeEl) {
192
198
  codeEl.innerHTML = lines.map(l => `<span class="cl">${l}</span>`).join('')
193
199
  }
194
200
 
195
- // Place a "" marker at the start of every wrapped continuation row. CSS has no
196
- // selector for soft-wrap rows, so we measure them with a Range. The deck is
197
- // rendered at a fixed layout width and merely CSS-scaled, so wrap positions are
198
- // stable; we divide measured offsets by the current scale to get layout pixels.
201
+ // Place a "" marker at the end of every row that soft-wraps (i.e. every visual
202
+ // row except the last). CSS has no selector for soft-wrap rows, so we measure
203
+ // them with a Range. The deck is rendered at a fixed layout width and merely
204
+ // CSS-scaled, so wrap positions are stable; we divide measured offsets by the
205
+ // current scale to get layout pixels.
199
206
  function decorateWrappedLines(root, scale) {
200
207
  if (!root) return
201
208
  const s = scale || 1
@@ -209,20 +216,28 @@ function decorateWrappedLines(root, scale) {
209
216
  if (!rects.length) continue
210
217
 
211
218
  const base = line.getBoundingClientRect()
212
- const tops = []
219
+ // Group the rects (one per inline fragment) into visual rows keyed by
220
+ // their top offset, tracking the rightmost text edge of each row — that
221
+ // edge is where the row visually ends, i.e. the wrap point.
222
+ const rows = []
213
223
  for (const r of rects) {
214
224
  if (r.width === 0 && r.height === 0) continue
215
- const t = Math.round(r.top - base.top)
216
- if (!tops.length || Math.abs(tops[tops.length - 1] - t) > 2) tops.push(t)
225
+ const top = Math.round(r.top - base.top)
226
+ const right = r.right - base.left
227
+ const row = rows.find(x => Math.abs(x.top - top) <= 2)
228
+ if (row) row.right = Math.max(row.right, right)
229
+ else rows.push({ top, right })
217
230
  }
218
- if (tops.length <= 1) continue // line did not wrap
231
+ if (rows.length <= 1) continue // line did not wrap
219
232
 
220
- for (let i = 1; i < tops.length; i++) {
233
+ // Mark the end of every row except the last — those are the wrap points.
234
+ for (let i = 0; i < rows.length - 1; i++) {
221
235
  const marker = document.createElement('span')
222
236
  marker.className = 'wrap-marker'
223
- marker.textContent = ''
237
+ marker.textContent = ''
224
238
  marker.setAttribute('aria-hidden', 'true')
225
- marker.style.top = (tops[i] / s) + 'px'
239
+ marker.style.top = (rows[i].top / s) + 'px'
240
+ marker.style.left = (rows[i].right / s) + 'px'
226
241
  line.appendChild(marker)
227
242
  }
228
243
  }