Slide Editing
A slide's content is a self-contained HTML string rendered at its aspect
ratio's intrinsic size: 16:9 is 960x540, 1:1 is 1080x1080, 9:16 is 540x960,
and 4:5 is 864x1080. Never assume a 1920x1080 canvas.
Read before
Read a reference with docs-search --slug "skill-slide-editing--references-<file>",
for example skill-slide-editing--references-animations.
| Situation |
Read |
| Changing only colors, borders, shadows, or backgrounds, or matching every slide to one slide's look |
references/restyling.md |
| Adding, changing, or removing click-to-reveal animations |
references/animations.md |
| Adding, moving, duplicating, or restyling hand-placed text boxes and other freeform objects |
references/freeform-objects.md |
| Adding or editing a video |
references/video.md |
Wrapper and styling
Every slide's outer .fmd-slide div carries the semantic --deck-* contract;
create-deck (Slide Wrapper) shows both forms. With a design system linked,
map --deck-* to --ds-*. Without one, write literal values: the renderer
publishes only --ds-bg for unlinked decks, so any other var(--ds-*, ...)
resolves to its fallback and the slide renders unstyled.
Keep one deck-level contract: the same canvas, type pairing, palette, and
accent on every slide, varying composition rather than theme. Never alternate
light and dark slides or add a one-off font or palette unless asked. For polish
or "make it beautiful", read slide-design; a linked system's tokens still win.
Updating a slide
A small edit is a same-or-shorter text replacement, a selected-object or
selectedText edit, or a single style tweak. It is one update-slide call:
skip steps 2, 4, and 5 and the fit and contrast checks below.
- Take the deck, slide ID, and selection from this turn's context block; call
view-screen only when they are missing. The user navigates and reselects
between turns, so never reuse a previous turn's slide ID or selection.
This, here, or this slide with nothing selected means the current slide;
ask which slide only when there is no current slide.
- When the edit changes facts, brand language, or layout, follow
creative-context first. If retrieval yields a new context pack, keep its
contextPackId with the deck provenance; existing HTML is not proof of
which source version shaped it. Keep an approved native template or
component when it fits; generate new structure only when the corpus is
empty.
- Write with
update-slide: deckId, slideId, and ordered edits (exact
replace, insert before/after, replace between markers, regex). Edits apply
atomically under the deck lock, so one failed edit writes nothing.
- To place a generated image artifact (such as a QR code) on the slide, use
its returned HTTPS URL as an
<img src="..."> in the slide HTML and write
that markup with update-slide using the same targeted edit or
fullContent flow above. Keep it within the slide's existing layout and
give it useful alt text. Do not add a separate image action: the slide
sanitizer permits HTTPS image sources.
- Selected text: if the context or
view-screen gives an exact
selectedText range,
send one literal replace with the selected text as find and
expectedMatches: 1. Use selectionSlideId and
selectionSlideContentHash when present (the selection can be on another
slide); otherwise currentSlideId and currentSlideContentHash. Never
pair a selectionSlideId with the current slide's hash. Skip get-deck, fullContent, and layout-fit waits.
- Slides you wrote this run: you already hold their HTML, so send
edits directly (one patch-deck with patch-slide edits for several
slides) without re-reading. Read with get-deck only if an edit fails to
match or the write is rejected as stale; someone may have edited it since.
- Otherwise (truncated, ambiguous, split by markup, or structural): call
get-deck with that slideId (compact=false for full HTML) and use its
contentHash as baseContentHash. Quote find text from that
unformatted HTML: format=true is for reading only and rewrites spacing
(padding: 4px vs stored padding:4px), so its text can miss.
- Trend values: when you change the number in a
data-trend="auto"
element, set its --trend to var(--trend-up) for a leading "+" or
positive value, var(--trend-down) for "-" or "−", and
var(--trend-flat) for an unsigned zero when the element defines
--trend-flat.
- Use
fullContent only for an intentional full rewrite, never to make a
small change. format=true on update-slide applies to edits and
objectId only, not fullContent: it formats the stored HTML before
matching find and persists readable line breaks, so use it only when
every find was quoted from a get-deck format=true read.
- Read back with
get-deck (or a thumbnail's .slide-content
textContent), never document.body.innerText: thumbnails use
content-visibility: auto, so their text is empty in a hidden tab, and the
canvas shows only the selected slide.
- For factual edits, check changed text against the source: quote, speaker,
date, metric, and uncertainty status. Visual similarity is not source
fidelity.
Never write deck rows directly or add raw full-deck writes. Browser/editor code enqueues granular
operations through patch-deck / DeckContext.tsx instead of replacing the
whole deck JSON.
Report only what writes returned. patch-deck lists changed slides in
updatedSlideIds and byte-identical ones in unchangedSlideIds; an unchanged
slide was not restyled. update-slide fails with slide_edit_noop, and both
reject a batch where nothing changed, so re-read and send different content
instead of describing changes that did not land.
Fit and layout checks
The create-deck Fit budget applies: on 16:9 with 64px 80px padding the
content area is 800x412px, so use at most two title lines, three short bullets
or cards, and two or three items per column. When an edit adds or lengthens
text, redo the height arithmetic. When the user asks to add content to a named
or current slide, keep it on that slide with a compact layout (columns, a
metric grid, tighter gaps); split only if the user agrees, or if it cannot fit
at 16px, and then say so. Body text stays at least 16px. Never hide overflow
with zoom, transform: scale(), clipping, or scroll; reducing explicit padding
is allowed.
Run the checks below only when an edit changes layout or makes text longer.
After those edits, call get-layout-overflows once, and once more only after
repairing a measured overflow. It reads the open editor's latest measurements
and cannot trigger new ones, so repeating it this turn changes nothing. If
status is unknown, name the unmeasured slide numbers and IDs and never claim
the deck fits.
Contrast
Run audit-contrast as the last step of any turn that created slides or
changed colors, layout, or text length (after layout repairs, right before the
final response), and whenever readability or accessibility comes up. If the deck is not open in the editor,
say contrast was not checked.
Fix failures in one pass by adjusting the role (--deck-muted, --deck-ink, a
surface), not one element's hex. Replacement colors must fit the theme:
- Design system linked: pick a passing color from its palette
(
get-design-system). If none passes, keep the token and report it.
- No design system: reuse a deck color, or shift the failing color's lightness
while keeping its hue.
Never add an unrelated hue to pass. Audit once more, then report what remains;
re-audit once if slides come back skipped as stale-render. Skipped slides and
unverified text (over images, gradients, or effects) were not checked: name
them, and do not call the deck accessible or those slides fine.
Flow layout and the editor
Keep generated flex and grid content in normal flow; create a deliberate
freeform object instead of absolute-positioning a layout child to make it
draggable. The editor presents flow content as flat objects the way Google
Slides does, so write markup that maps cleanly:
- A card is one painted box (background, border, or shadow on a single element)
that owns its text. Never stack separately positioned text over a card
background.
- Text containers, including
.fmd-text-box, have no fixed height
(min-height only for a deliberate minimum), so text grows instead of
overflowing.
- Never write
contain or contain-intrinsic-size; they break the editor's
measuring and the PPTX export.
- No inline
<svg>; the sanitizer removes it. Use styled divs or an <img>.
- Place and size absolute objects on the 8px grid: positions, sizes, gaps, and
padding in multiples of 8; borders, radius, and type in whole px. Never write
a fractional px value or one computed with arithmetic that can leave decimals.
- Keep nesting shallow. Unpainted wrappers with no direct text (grid rows,
columns) are fine; the pointer skips them.
- Ids belong to freeform objects only. Never stamp
data-slide-object-id on a
flow region: any id marks an object freeform and export-pptx rejects it.
Preserve existing ids when rewriting a slide, and never save runtime
data-builder-id values.
- An empty hidden
.fmd-layout-spacer[data-slide-layout-spacer-for="ID"]
reserves the flow slot of a hand-moved object. Keep it while its owner
exists and delete both together.
- Keep the empty
<span data-slide-number></span> and
<span data-slide-total></span> tokens when restyling or rewriting a footer.
They are empty in the saved HTML on purpose; never type digits over them.
- Use
fmd-img-placeholder divs whose text names the content to show (see
create-deck references/slide-templates.md) for diagrams, charts, and
photos, then generate real images; never rebuild complex visuals in HTML/CSS.
Slide writes can return hygieneWarnings (inline svg and other markup the
sanitizer strips, typed page numbers, fixed px heights on text, contain,
stacked absolute text, deep nesting, tiny text). Fix them with update-slide
before finishing; a missing field means the lint found nothing.
Skipping slides
A patch-deck patch-slide with skipped: true hides a slide from
Present/Presenter without deleting it; skipped: false restores it. The rail's
right-click Skip slide does the same.
Transitions
Slide transitions (type and speed, Google Slides catalog) are set with the
patch-slide op of patch-deck, or with its add-slide op on creation. Read
references/transitions.md before changing them.
1---2name: slide-editing3description: >-4 Edit individual slides, including content formatting, HTML styling, and5 bounded source and visual-fidelity checks. Use when changing an existing6 slide rather than creating a new deck.7metadata:8 source: https://skillmd.com/skills/builderio/slide-editing9---1011# Slide Editing1213A slide's `content` is a self-contained HTML string rendered at its aspect14ratio's intrinsic size: 16:9 is 960x540, 1:1 is 1080x1080, 9:16 is 540x960,15and 4:5 is 864x1080. Never assume a 1920x1080 canvas.1617## Read before1819Read a reference with `docs-search --slug "skill-slide-editing--references-<file>"`,20for example `skill-slide-editing--references-animations`.2122| Situation | Read |23| --- | --- |24| Changing only colors, borders, shadows, or backgrounds, or matching every slide to one slide's look | `references/restyling.md` |25| Adding, changing, or removing click-to-reveal animations | `references/animations.md` |26| Adding, moving, duplicating, or restyling hand-placed text boxes and other freeform objects | `references/freeform-objects.md` |27| Adding or editing a video | `references/video.md` |2829## Wrapper and styling3031Every slide's outer `.fmd-slide` div carries the semantic `--deck-*` contract;32`create-deck` (Slide Wrapper) shows both forms. With a design system linked,33map `--deck-*` to `--ds-*`. Without one, write literal values: the renderer34publishes only `--ds-bg` for unlinked decks, so any other `var(--ds-*, ...)`35resolves to its fallback and the slide renders unstyled.3637Keep one deck-level contract: the same canvas, type pairing, palette, and38accent on every slide, varying composition rather than theme. Never alternate39light and dark slides or add a one-off font or palette unless asked. For polish40or "make it beautiful", read `slide-design`; a linked system's tokens still win.4142## Updating a slide4344A small edit is a same-or-shorter text replacement, a selected-object or45`selectedText` edit, or a single style tweak. It is one `update-slide` call:46skip steps 2, 4, and 5 and the fit and contrast checks below.47481. Take the deck, slide ID, and selection from this turn's context block; call49 `view-screen` only when they are missing. The user navigates and reselects50 between turns, so never reuse a previous turn's slide ID or selection.51 This, here, or this slide with nothing selected means the current slide;52 ask which slide only when there is no current slide.532. When the edit changes facts, brand language, or layout, follow54 `creative-context` first. If retrieval yields a new context pack, keep its55 `contextPackId` with the deck provenance; existing HTML is not proof of56 which source version shaped it. Keep an approved native template or57 component when it fits; generate new structure only when the corpus is58 empty.593. Write with `update-slide`: `deckId`, `slideId`, and ordered `edits` (exact60 replace, insert before/after, replace between markers, regex). Edits apply61 atomically under the deck lock, so one failed edit writes nothing.62 - To place a generated image artifact (such as a QR code) on the slide, use63 its returned HTTPS URL as an `<img src="...">` in the slide HTML and write64 that markup with `update-slide` using the same targeted edit or65 `fullContent` flow above. Keep it within the slide's existing layout and66 give it useful `alt` text. Do not add a separate image action: the slide67 sanitizer permits HTTPS image sources.68 - **Selected text:** if the context or `view-screen` gives an exact69 `selectedText` range,70 send one literal replace with the selected text as `find` and71 `expectedMatches: 1`. Use `selectionSlideId` and72 `selectionSlideContentHash` when present (the selection can be on another73 slide); otherwise `currentSlideId` and `currentSlideContentHash`. Never74 pair a `selectionSlideId` with the current slide's hash. Skip `get-deck`, `fullContent`, and layout-fit waits.75 - **Slides you wrote this run:** you already hold their HTML, so send76 `edits` directly (one `patch-deck` with `patch-slide` edits for several77 slides) without re-reading. Read with `get-deck` only if an edit fails to78 match or the write is rejected as stale; someone may have edited it since.79 - **Otherwise** (truncated, ambiguous, split by markup, or structural): call80 `get-deck` with that `slideId` (`compact=false` for full HTML) and use its81 `contentHash` as `baseContentHash`. Quote `find` text from that82 unformatted HTML: `format=true` is for reading only and rewrites spacing83 (`padding: 4px` vs stored `padding:4px`), so its text can miss.84 - **Trend values:** when you change the number in a `data-trend="auto"`85 element, set its `--trend` to `var(--trend-up)` for a leading "+" or86 positive value, `var(--trend-down)` for "-" or "−", and87 `var(--trend-flat)` for an unsigned zero when the element defines88 `--trend-flat`.89 - Use `fullContent` only for an intentional full rewrite, never to make a90 small change. `format=true` on `update-slide` applies to `edits` and91 `objectId` only, not `fullContent`: it formats the stored HTML before92 matching `find` and persists readable line breaks, so use it only when93 every `find` was quoted from a `get-deck format=true` read.944. Read back with `get-deck` (or a thumbnail's `.slide-content`95 `textContent`), never `document.body.innerText`: thumbnails use96 `content-visibility: auto`, so their text is empty in a hidden tab, and the97 canvas shows only the selected slide.985. For factual edits, check changed text against the source: quote, speaker,99 date, metric, and uncertainty status. Visual similarity is not source100 fidelity.101102Never write deck rows directly or add raw full-deck writes. Browser/editor code enqueues granular103operations through `patch-deck` / `DeckContext.tsx` instead of replacing the104whole deck JSON.105106Report only what writes returned. `patch-deck` lists changed slides in107`updatedSlideIds` and byte-identical ones in `unchangedSlideIds`; an unchanged108slide was not restyled. `update-slide` fails with `slide_edit_noop`, and both109reject a batch where nothing changed, so re-read and send different content110instead of describing changes that did not land.111112## Fit and layout checks113114The `create-deck` Fit budget applies: on 16:9 with `64px 80px` padding the115content area is 800x412px, so use at most two title lines, three short bullets116or cards, and two or three items per column. When an edit adds or lengthens117text, redo the height arithmetic. When the user asks to add content to a named118or current slide, keep it on that slide with a compact layout (columns, a119metric grid, tighter gaps); split only if the user agrees, or if it cannot fit120at 16px, and then say so. Body text stays at least 16px. Never hide overflow121with zoom, `transform: scale()`, clipping, or scroll; reducing explicit padding122is allowed.123124Run the checks below only when an edit changes layout or makes text longer.125After those edits, call `get-layout-overflows` once, and once more only after126repairing a measured overflow. It reads the open editor's latest measurements127and cannot trigger new ones, so repeating it this turn changes nothing. If128status is unknown, name the unmeasured slide numbers and IDs and never claim129the deck fits.130131## Contrast132133Run `audit-contrast` as the last step of any turn that created slides or134changed colors, layout, or text length (after layout repairs, right before the135final response), and whenever readability or accessibility comes up. If the deck is not open in the editor,136say contrast was not checked.137138Fix failures in one pass by adjusting the role (`--deck-muted`, `--deck-ink`, a139surface), not one element's hex. Replacement colors must fit the theme:140141- Design system linked: pick a passing color from its palette142 (`get-design-system`). If none passes, keep the token and report it.143- No design system: reuse a deck color, or shift the failing color's lightness144 while keeping its hue.145146Never add an unrelated hue to pass. Audit once more, then report what remains;147re-audit once if slides come back skipped as `stale-render`. Skipped slides and148unverified text (over images, gradients, or effects) were not checked: name149them, and do not call the deck accessible or those slides fine.150151## Flow layout and the editor152153Keep generated flex and grid content in normal flow; create a deliberate154freeform object instead of absolute-positioning a layout child to make it155draggable. The editor presents flow content as flat objects the way Google156Slides does, so write markup that maps cleanly:157158- A card is one painted box (background, border, or shadow on a single element)159 that owns its text. Never stack separately positioned text over a card160 background.161- Text containers, including `.fmd-text-box`, have no fixed `height`162 (`min-height` only for a deliberate minimum), so text grows instead of163 overflowing.164- Never write `contain` or `contain-intrinsic-size`; they break the editor's165 measuring and the PPTX export.166- No inline `<svg>`; the sanitizer removes it. Use styled divs or an `<img>`.167- Place and size absolute objects on the 8px grid: positions, sizes, gaps, and168 padding in multiples of 8; borders, radius, and type in whole px. Never write169 a fractional px value or one computed with arithmetic that can leave decimals.170- Keep nesting shallow. Unpainted wrappers with no direct text (grid rows,171 columns) are fine; the pointer skips them.172- Ids belong to freeform objects only. Never stamp `data-slide-object-id` on a173 flow region: any id marks an object freeform and `export-pptx` rejects it.174 Preserve existing ids when rewriting a slide, and never save runtime175 `data-builder-id` values.176- An empty hidden `.fmd-layout-spacer[data-slide-layout-spacer-for="ID"]`177 reserves the flow slot of a hand-moved object. Keep it while its owner178 exists and delete both together.179- Keep the empty `<span data-slide-number></span>` and180 `<span data-slide-total></span>` tokens when restyling or rewriting a footer.181 They are empty in the saved HTML on purpose; never type digits over them.182- Use `fmd-img-placeholder` divs whose text names the content to show (see183 `create-deck` `references/slide-templates.md`) for diagrams, charts, and184 photos, then generate real images; never rebuild complex visuals in HTML/CSS.185186Slide writes can return `hygieneWarnings` (inline svg and other markup the187sanitizer strips, typed page numbers, fixed px heights on text, `contain`,188stacked absolute text, deep nesting, tiny text). Fix them with `update-slide`189before finishing; a missing field means the lint found nothing.190191## Skipping slides192193A `patch-deck` `patch-slide` with `skipped: true` hides a slide from194Present/Presenter without deleting it; `skipped: false` restores it. The rail's195right-click Skip slide does the same.196197## Transitions198199Slide transitions (type and speed, Google Slides catalog) are set with the200`patch-slide` op of `patch-deck`, or with its `add-slide` op on creation. Read201`references/transitions.md` before changing them.