@treasure-ai/treasure-deck 2026.11.8 → 2026.11.10
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/dist/analytics.d.ts +2 -1
- package/dist/analytics.js +3 -2
- package/dist/analytics.js.map +1 -1
- package/docs/commands.md +3 -3
- package/docs/syntax.md +1 -1
- package/package.json +1 -1
- package/runtime/base.css +2 -0
- package/runtime/runtime.js +40 -8
- package/skills/treasure-deck/SKILL.md +1 -1
package/dist/analytics.d.ts
CHANGED
|
@@ -25,7 +25,8 @@ export declare function deckInfo(file: string, title: string, theme: string, now
|
|
|
25
25
|
export declare function withAnalytics(html: string, info: DeckInfo, writeKey?: string): string;
|
|
26
26
|
/**
|
|
27
27
|
* The inline script, or '' without a write key. It goes before the runtime, which shows the first slide as it
|
|
28
|
-
* starts. It queues calls until the SDK loads (the SDK's own loader stub
|
|
28
|
+
* starts. It queues calls until the SDK loads (the SDK's own loader stub, except that it adds the SDK's script to
|
|
29
|
+
* <head>: the stock stub inserts it before the page's first script, which may be inside a slide) and listens for the runtime's
|
|
29
30
|
* `deck:show` and `deck:action` events. A deck that can't reach the CDN works as before; it just sends nothing.
|
|
30
31
|
*
|
|
31
32
|
* Every row carries the deck's build info, `host` (apps_script, file, or web), and `view_id`: a random ID made for
|
package/dist/analytics.js
CHANGED
|
@@ -36,7 +36,8 @@ export function withAnalytics(html, info, writeKey = WRITE_KEY) {
|
|
|
36
36
|
const json = (v) => JSON.stringify(v).replace(/</g, '\\u003c');
|
|
37
37
|
/**
|
|
38
38
|
* The inline script, or '' without a write key. It goes before the runtime, which shows the first slide as it
|
|
39
|
-
* starts. It queues calls until the SDK loads (the SDK's own loader stub
|
|
39
|
+
* starts. It queues calls until the SDK loads (the SDK's own loader stub, except that it adds the SDK's script to
|
|
40
|
+
* <head>: the stock stub inserts it before the page's first script, which may be inside a slide) and listens for the runtime's
|
|
40
41
|
* `deck:show` and `deck:action` events. A deck that can't reach the CDN works as before; it just sends nothing.
|
|
41
42
|
*
|
|
42
43
|
* Every row carries the deck's build info, `host` (apps_script, file, or web), and `view_id`: a random ID made for
|
|
@@ -46,7 +47,7 @@ export function analyticsScript(info, writeKey = WRITE_KEY) {
|
|
|
46
47
|
if (!writeKey)
|
|
47
48
|
return '';
|
|
48
49
|
return `<script>
|
|
49
|
-
!function(t,e){if(void 0===e[t]){e[t]=function(){e[t].clients.push(this),this._init=[Array.prototype.slice.call(arguments)]},e[t].clients=[];for(var r=["addRecord","blockEvents","fetchServerCookie","fetchGlobalID","fetchUserSegments","resetUUID","ready","setSignedMode","setAnonymousMode","set","trackEvent","trackPageview","trackClicks","unblockEvents"],s=0;s<r.length;s++){var c=r[s];e[t].prototype[c]=function(t){return function(){return this["_"+t]=this["_"+t]||[],this["_"+t].push(Array.prototype.slice.call(arguments)),this}}(c)}var n=document.createElement("script");n.async=!0,n.src=${json(SDK_URL)};
|
|
50
|
+
!function(t,e){if(void 0===e[t]){e[t]=function(){e[t].clients.push(this),this._init=[Array.prototype.slice.call(arguments)]},e[t].clients=[];for(var r=["addRecord","blockEvents","fetchServerCookie","fetchGlobalID","fetchUserSegments","resetUUID","ready","setSignedMode","setAnonymousMode","set","trackEvent","trackPageview","trackClicks","unblockEvents"],s=0;s<r.length;s++){var c=r[s];e[t].prototype[c]=function(t){return function(){return this["_"+t]=this["_"+t]||[],this["_"+t].push(Array.prototype.slice.call(arguments)),this}}(c)}var n=document.createElement("script");n.async=!0,n.src=${json(SDK_URL)};document.head.appendChild(n)}}("Treasure",window);
|
|
50
51
|
(function () {
|
|
51
52
|
var td = new Treasure(${json({ database: DATABASE, writeKey, host: HOST })});
|
|
52
53
|
td.setAnonymousMode();
|
package/dist/analytics.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"analytics.js","sourceRoot":"","sources":["../src/analytics.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAA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AAU,aAAa,CAAC,IAAY,EAAE,IAAc,EAAE,QAAQ,GAAG,SAAS;IAC9E,MAAM,EAAE,GAAG,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;IACvC,MAAM,MAAM,GAAG,eAAe,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;IAC/C,OAAO,EAAE,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;AAChF,CAAC;AAED,MAAM,IAAI,GAAG,CAAC,CAAU,EAAE,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;AAExE;;;;;;;;GAQG;AACH,MAAM,UAAU,eAAe,CAAC,IAAc,EAAE,QAAQ,GAAG,SAAS;IAClE,IAAI,CAAC,QAAQ;QAAE,OAAO,EAAE,CAAC;IACzB,OAAO;ilBACwkB,IAAI,CAAC,OAAO,CAAC;;0BAEpkB,IAAI,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;;gBAE5D,IAAI,CAAC,KAAK,CAAC,YAAY,IAAI,CAAC,IAAI,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsChD,CAAC;AACF,CAAC"}
|
package/docs/commands.md
CHANGED
|
@@ -183,13 +183,13 @@ Touch: swipe to navigate, pinch out for the overview. On portrait phones the dec
|
|
|
183
183
|
|
|
184
184
|
**Share panel (`s`):** copy the deck link or a link to the current slide, show a QR code full screen (for the audience to follow on their phones), print or save as PDF, copy an `<iframe>` embed snippet (see below), and download the deck's source as a `.zip` of its folder (see [`deck import`](#importing-a-shared-deck-deck-import)).
|
|
185
185
|
|
|
186
|
-
**Embedding in a web page:** add `?embed=1` to a published deck's URL and put it in an `<iframe>`, as Speaker Deck embeds work. Share panel ▸ Copy embed snippet gives one that fills its column at 16:9 and starts at the current slide (`#/<n>`):
|
|
186
|
+
**Embedding in a web page:** add `?embed=1` to a published deck's URL and put it in an `<iframe>`, as Speaker Deck embeds work. Share panel ▸ Copy embed snippet gives one that fills its column at 16:9, with rounded corners and a hairline border that reads on light and dark pages, and starts at the current slide (`#/<n>`):
|
|
187
187
|
|
|
188
188
|
```html
|
|
189
|
-
<iframe src="https://script.google.com/macros/s/…/exec?embed=1" style="width:100%;aspect-ratio:16/9;border:
|
|
189
|
+
<iframe src="https://script.google.com/macros/s/…/exec?embed=1" style="display:block;width:100%;aspect-ratio:16/9;border:1px solid rgba(128,128,128,.3);border-radius:12px" allow="fullscreen" allowfullscreen></iframe>
|
|
190
190
|
```
|
|
191
191
|
|
|
192
|
-
In embed mode the deck shows a control bar on hover (always on touch screens): ‹ ›, the slide number, full screen, and Open ↗ for the whole deck in a new tab. It doesn't take the keyboard until the reader clicks in, and only the reader's keys work (navigation, `f`, `o`, `s`, `i`, `?`). Where the browser refuses full screen inside the frame, the deck opens in a new tab instead. Readers on other sites can load the frame only when the deck is published for anyone: an organization-only page needs a Google sign-in, which browsers don't send to a frame on another site.
|
|
192
|
+
In embed mode the deck shows a control bar on hover (always on touch screens): ‹ ›, the slide number, full screen, a light/dark switch (☾ / ☀, labeled with the mode it switches to; slides with their own `{mode=…}` keep it), and Open ↗ for the whole deck in a new tab. It doesn't take the keyboard until the reader clicks in, and only the reader's keys work (navigation, `f`, `o`, `d`, `s`, `i`, `?`). The reader's light/dark choice lasts until the page reloads, and it doesn't reach other windows showing the deck. Add `&toc=1` to the URL to start with the table of contents column, or `&toc=0` to start without it even when the deck sets `toc: sidebar`; the column shrinks with the slide, so it suits wide frames. Where the browser refuses full screen inside the frame, the deck opens in a new tab instead. Readers on other sites can load the frame only when the deck is published for anyone: an organization-only page needs a Google sign-in, which browsers don't send to a frame on another site.
|
|
193
193
|
|
|
194
194
|
## Updating: `deck update`
|
|
195
195
|
|
package/docs/syntax.md
CHANGED
|
@@ -96,7 +96,7 @@ Text never shrinks on its own; `deck check` reports a slide that overflows. For
|
|
|
96
96
|
|
|
97
97
|
### Table of contents
|
|
98
98
|
|
|
99
|
-
Press `t` to show or hide a left column on every slide; `toc: sidebar` shows it from the start. The slide is scaled down beside it as a whole, so its layout stays exactly as without the column: nothing rewraps or moves. It lists the sections (including those whose divider is hidden), highlights the current one, and shows the titles of the current section's slides with the current slide marked. Click an entry to jump to that slide. It is on title, section, and full-bleed slides too, so the outline stays in view while paging through the deck. It is part of the slide, so it appears when presenting and in PDFs, where its entries are links.
|
|
99
|
+
Press `t` to show or hide a left column on every slide; `toc: sidebar` shows it from the start. A link's `?toc=1` or `?toc=0` shows or hides it at first instead, whatever the deck sets (useful in an [embed](commands.md#presenting) whose width you know). The slide is scaled down beside it as a whole, so its layout stays exactly as without the column: nothing rewraps or moves. It lists the sections (including those whose divider is hidden), highlights the current one, and shows the titles of the current section's slides with the current slide marked. Click an entry to jump to that slide. It is on title, section, and full-bleed slides too, so the outline stays in view while paging through the deck. It is part of the slide, so it appears when presenting and in PDFs, where its entries are links.
|
|
100
100
|
|
|
101
101
|
## Images
|
|
102
102
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@treasure-ai/treasure-deck",
|
|
3
|
-
"version": "2026.11.
|
|
3
|
+
"version": "2026.11.10",
|
|
4
4
|
"description": "Markdown presentations without <div> markup: four layouts, themes, and a single-file HTML output that publishes to Apps Script",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
6
6
|
"homepage": "https://www.npmjs.com/package/@treasure-ai/treasure-deck",
|
package/runtime/base.css
CHANGED
|
@@ -416,6 +416,8 @@ body { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
|
|
|
416
416
|
position: fixed; left: 50%; bottom: 12px; transform: translateX(-50%); z-index: 30; display: flex; align-items: center; gap: 2px;
|
|
417
417
|
padding: 4px; border-radius: 999px; background: rgba(20, 18, 16, .8); color: #f4efe6;
|
|
418
418
|
font: 14px/1 system-ui, -apple-system, 'Segoe UI', sans-serif; font-variant-numeric: tabular-nums;
|
|
419
|
+
/* (Phone browsers would otherwise enlarge the bar's small text and wrap it.) */
|
|
420
|
+
white-space: nowrap; -webkit-text-size-adjust: 100%; text-size-adjust: 100%;
|
|
419
421
|
opacity: 0; transition: opacity .2s ease;
|
|
420
422
|
}
|
|
421
423
|
.deck-embed-bar[hidden], .deck-embed-bar [hidden] { display: none; }
|
package/runtime/runtime.js
CHANGED
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
'<h2>Keyboard shortcuts</h2><table>' +
|
|
60
60
|
[['→ Space PgDn', 'Next slide'], ['← PgUp', 'Previous slide'], ['Home / End', 'First / last'],
|
|
61
61
|
['1 2 … Enter', 'Go to slide'], ['f', 'Full screen'], ['o / Esc', 'Overview'], ['t', 'Table of contents', 1], ['p', 'Speaker notes + timer', 1], ['P', 'Presenter window', 1], ['k / r', 'Pause / reset the timer', 1],
|
|
62
|
-
['b / .', 'Black screen', 1], ['d', 'Light / dark'
|
|
62
|
+
['b / .', 'Black screen', 1], ['d', 'Light / dark'], ['l', 'Laser pointer', 1], ['s', 'Share'], ['i', 'About this deck'], ['?', 'This help']]
|
|
63
63
|
.map(function (r) { return '<tr' + (r[2] ? ' class="deck-not-embed"' : '') + '><td><kbd>' + r[0] + '</kbd></td><td>' + r[1] + '</td></tr>'; }).join('') +
|
|
64
64
|
'</table>');
|
|
65
65
|
help.hidden = true;
|
|
@@ -107,6 +107,7 @@
|
|
|
107
107
|
'<button data-go="-1" aria-label="Previous slide">‹</button><span class="deck-embed-count"></span>' +
|
|
108
108
|
'<button data-go="1" aria-label="Next slide">›</button>' +
|
|
109
109
|
'<button data-act="fullscreen" aria-label="Full screen">⛶</button>' +
|
|
110
|
+
'<button data-act="mode"></button>' +
|
|
110
111
|
'<a data-act="open" target="_blank" rel="noopener">Open ↗</a>');
|
|
111
112
|
embedBar.hidden = true;
|
|
112
113
|
[progress, black, laser, gotoBox, help, about, share, notesPanel, embedBar].forEach(function (e) { deck.appendChild(e); });
|
|
@@ -213,9 +214,13 @@
|
|
|
213
214
|
// A feature used, for the access metrics `deck build` adds (full screen and print are seen there directly).
|
|
214
215
|
function used(action) { document.dispatchEvent(new CustomEvent('deck:action', { detail: { action: action } })); }
|
|
215
216
|
|
|
217
|
+
// The ?toc= the page was opened with, which deckUrl passes on (Apps Script's base URL has no query string).
|
|
218
|
+
var tocParam = '';
|
|
216
219
|
// The deck's own URL, without ?embed=1: what the share panel copies and the embed bar opens.
|
|
217
220
|
function deckUrl() {
|
|
218
|
-
|
|
221
|
+
var url = host.baseUrl().replace(/([?&])embed=1(&|$)/, function (m, sep, next) { return next ? sep : ''; });
|
|
222
|
+
if (url && tocParam && !/[?&]toc=/.test(url)) url += (url.indexOf('?') < 0 ? '?' : '&') + 'toc=' + tocParam;
|
|
223
|
+
return url;
|
|
219
224
|
}
|
|
220
225
|
// Opens the whole deck in a new tab at this slide; false when the page has no URL to open.
|
|
221
226
|
function openFull() {
|
|
@@ -239,11 +244,28 @@
|
|
|
239
244
|
var open = embedBar.querySelector('[data-act="open"]'), url = deckUrl();
|
|
240
245
|
open.hidden = !url;
|
|
241
246
|
if (url) open.href = url + '#/' + (current + 1);
|
|
247
|
+
renderModeButton();
|
|
248
|
+
// Around the slide (a frame that isn't 16:9, and its antialiased edge), the slide's own color instead of black.
|
|
249
|
+
var bg = getComputedStyle(slides[current]).getPropertyValue('--deck-bg').trim();
|
|
250
|
+
document.documentElement.style.background = document.body.style.background = bg;
|
|
251
|
+
}
|
|
252
|
+
// The embed bar's light/dark button names what it does: the mode a press switches the deck to.
|
|
253
|
+
function renderModeButton() {
|
|
254
|
+
var b = embedBar.querySelector('[data-act="mode"]'), dark = deck.getAttribute('data-mode') === 'dark';
|
|
255
|
+
var label = dark ? 'Switch to light mode' : 'Switch to dark mode';
|
|
256
|
+
b.textContent = dark ? '☀' : '☾';
|
|
257
|
+
b.setAttribute('aria-label', label);
|
|
258
|
+
b.title = label + ' (d)';
|
|
259
|
+
}
|
|
260
|
+
function toggleMode() {
|
|
261
|
+
setMode(deck.getAttribute('data-mode') === 'dark' ? 'light' : 'dark');
|
|
262
|
+
used('mode');
|
|
242
263
|
}
|
|
243
264
|
embedBar.addEventListener('click', function (e) {
|
|
244
|
-
var b = e.target.closest && e.target.closest('[data-go], [data-act="fullscreen"]');
|
|
265
|
+
var b = e.target.closest && e.target.closest('[data-go], [data-act="fullscreen"], [data-act="mode"]');
|
|
245
266
|
if (!b) return;
|
|
246
267
|
if (b.hasAttribute('data-go')) show(current + parseInt(b.getAttribute('data-go'), 10));
|
|
268
|
+
else if (b.getAttribute('data-act') === 'mode') toggleMode();
|
|
247
269
|
else fullscreen();
|
|
248
270
|
});
|
|
249
271
|
|
|
@@ -402,7 +424,7 @@
|
|
|
402
424
|
// A 16:9 iframe as wide as its column, starting at this slide.
|
|
403
425
|
function embedSnippet(base) {
|
|
404
426
|
var src = base + (base.indexOf('?') < 0 ? '?' : '&') + 'embed=1' + (current ? '#/' + (current + 1) : '');
|
|
405
|
-
return '<iframe src="' + src.replace(/&/g, '&').replace(/"/g, '"') + '" style="width:100%;aspect-ratio:16/9;border:
|
|
427
|
+
return '<iframe src="' + src.replace(/&/g, '&').replace(/"/g, '"') + '" style="display:block;width:100%;aspect-ratio:16/9;border:1px solid rgba(128,128,128,.3);border-radius:12px" allow="fullscreen" allowfullscreen></iframe>';
|
|
406
428
|
}
|
|
407
429
|
|
|
408
430
|
share.addEventListener('click', function (e) {
|
|
@@ -431,9 +453,11 @@
|
|
|
431
453
|
document.addEventListener('keydown', function (e) {
|
|
432
454
|
if (e.metaKey || e.ctrlKey || e.altKey) return;
|
|
433
455
|
var k = e.key;
|
|
434
|
-
if (embedded && !/^([0-9]|Enter|Arrow(Left|Right|Up|Down)|Page(Up|Down)|Backspace|Home|End| |f|o|Escape|s|i|\?)$/.test(k)) return;
|
|
456
|
+
if (embedded && !/^([0-9]|Enter|Arrow(Left|Right|Up|Down)|Page(Up|Down)|Backspace|Home|End| |f|o|Escape|s|i|d|\?)$/.test(k)) return;
|
|
435
457
|
if (/^[0-9]$/.test(k)) { typeDigit(k); return; }
|
|
436
458
|
if (k === 'Enter' && typed) { show(parseInt(typed, 10) - 1); typed = ''; gotoBox.hidden = true; return; }
|
|
459
|
+
// Enter and Space on a focused embed bar button press that button (not the next slide).
|
|
460
|
+
if (embedded && (k === 'Enter' || k === ' ') && embedBar.contains(e.target) && e.target.closest('button')) return;
|
|
437
461
|
if (deck.classList.contains('is-black') && k !== 'b' && k !== '.') { deck.classList.remove('is-black'); sync({ black: false }); renderPresenter(); return; }
|
|
438
462
|
switch (k) {
|
|
439
463
|
case 'ArrowRight': case 'ArrowDown': case 'PageDown': case ' ': show(current + 1); break;
|
|
@@ -452,7 +476,7 @@
|
|
|
452
476
|
case 'r': if (presenter) resetTimer(); break;
|
|
453
477
|
case 'k': if (presenter || !notesPanel.hidden) pauseTimer(); break;
|
|
454
478
|
case 'b': case '.': deck.classList.toggle('is-black'); sync({ black: deck.classList.contains('is-black') }); renderPresenter(); break;
|
|
455
|
-
case 'd':
|
|
479
|
+
case 'd': toggleMode(); break;
|
|
456
480
|
case 'l': deck.classList.toggle('is-laser'); if (deck.classList.contains('is-laser')) used('laser'); break;
|
|
457
481
|
case 's': toggle(share); break;
|
|
458
482
|
case 'i': toggle(about); break;
|
|
@@ -826,9 +850,13 @@
|
|
|
826
850
|
var frame = document.createElement('div');
|
|
827
851
|
frame.className = 'deck-component-root';
|
|
828
852
|
root.appendChild(frame);
|
|
829
|
-
|
|
830
|
-
|
|
853
|
+
// By type, not position: a page's other scripts may add theirs beside these (the TD SDK's stock loader
|
|
854
|
+
// inserts before the page's first script, which can be a component's).
|
|
855
|
+
var code = host.querySelector(':scope > script[type="text/x-deck-component"]');
|
|
856
|
+
var data = host.querySelector(':scope > script[type="application/json"]');
|
|
857
|
+
var entry = { host: host, frame: frame, code: code ? code.textContent : '', round: 0 };
|
|
831
858
|
try {
|
|
859
|
+
entry.data = JSON.parse((data && data.textContent) || 'null');
|
|
832
860
|
entry.factory = componentFactory(entry.code);
|
|
833
861
|
} catch (e) {
|
|
834
862
|
failComponent(entry, e);
|
|
@@ -1050,6 +1078,7 @@
|
|
|
1050
1078
|
if (!fromPeer) sync({ mode: mode });
|
|
1051
1079
|
refreshComponents();
|
|
1052
1080
|
renderPresenter();
|
|
1081
|
+
renderEmbedBar();
|
|
1053
1082
|
}
|
|
1054
1083
|
// An embed is a reader's copy: it neither steers nor follows a talk being presented from the same deck.
|
|
1055
1084
|
function sync(msg) {
|
|
@@ -1194,6 +1223,9 @@
|
|
|
1194
1223
|
} else host.read(function (hash, params) {
|
|
1195
1224
|
if (params.embed === '1') startEmbed();
|
|
1196
1225
|
else if (/\/presenter$/.test(hash)) startPresenter();
|
|
1226
|
+
// ?toc=1 / ?toc=0 shows or hides the table of contents column at first, over the deck's `toc: sidebar` (an embed
|
|
1227
|
+
// snippet's author knows how wide the frame is).
|
|
1228
|
+
if (params.toc === '1' || params.toc === '0') { tocParam = params.toc; deck.classList.toggle('show-toc', params.toc === '1'); }
|
|
1197
1229
|
var m = /^\/?(\d+)/.exec(hash);
|
|
1198
1230
|
// #/<n>/presented: slide n as presented (back to deck editor from /present), past the hidden slides.
|
|
1199
1231
|
var n = m ? parseInt(m[1], 10) - 1 : 0;
|
|
@@ -371,7 +371,7 @@ Treasure Work publishes a built deck as an Apps Script web page through the `sha
|
|
|
371
371
|
4. Give the user the URL. Keep the artifact id from the result. To update the same page after edits, rebuild and pass that id as `artifact_id`; without it, the publish creates a second page.
|
|
372
372
|
5. Publishing needs the user's Google account connected in Settings ▸ Connectors. If the tool reports that it is missing, tell the user to connect it.
|
|
373
373
|
|
|
374
|
-
To embed the deck in another web page (a blog post, a wiki, Google Sites), use the deck's URL with `?embed=1` in an `<iframe>`: the share panel's "Copy embed snippet" gives one. Embed mode shows ‹ › buttons, a slide counter, full screen, and "Open ↗", and it keeps the keys to the ones a reader needs. On other sites the frame loads only when the deck is published with `scope: "anyone"`.
|
|
374
|
+
To embed the deck in another web page (a blog post, a wiki, Google Sites), use the deck's URL with `?embed=1` in an `<iframe>`: the share panel's "Copy embed snippet" gives one. Embed mode shows ‹ › buttons, a slide counter, full screen, a light/dark switch, and "Open ↗", and it keeps the keys to the ones a reader needs. On other sites the frame loads only when the deck is published with `scope: "anyone"`.
|
|
375
375
|
|
|
376
376
|
A built page carries the deck's source, so whoever can open it can get the deck folder back (share panel ▸ Download source, or `deck import`), hidden slides included. Build with `--no-source` when the user wants the page shared but not its source.
|
|
377
377
|
|