Html build

From 5throck/ai-workspace-standards · View interactive version

Html build is an AI agent skill from the GitHub repository 5throck/ai-workspace-standards. Generates HTML slides from slide_deck.md and design_spec.md. Applies theme (data-theme attribute), binds images from image-manifest.json, inserts speaker intro and contact slides, checks balance. Responds to "make HTML", "generate slides", "add images", "add speaker intro" (Korean: "HTML 만들어줘", "슬라이

How to use this skill

Skill file

Context

Generates a single HTML file from slide_deck.md + design_spec.md, applies theme from lecture-profile.md, binds images from image-manifest.json, inserts special pages (speaker intro, contact), and checks balance. Slide data is embedded as a strict-JSON array (const slideData = [...]) inside the HTML. Strict-JSON means: all keys double-quoted, all string values double-quoted, no trailing commas, no JavaScript comments, no single-quoted strings, no template literals. Invoked at Stages 5-8, after Gate 3 (design approval).

When to Use


Execution Steps

Stage 5: HTML Slide Generation

File Structure: Single HTML file (lecture_[topic]_v1.html) + shared-pool images at deliverables/assets/images/ (photos, bound deck-relative as ../assets/images/…) + shared-pool diagrams at deliverables/assets/diagrams/ (SVG/PNG, bound deck-relative as ../assets/diagrams/…).

slideData Structure: Slide data lives as a strict-JSON array embedded as const slideData = [...] inside the HTML file. All keys and string values must use double-quotes; no trailing commas, no JS comments. This enables extract_slidedata.mjs to parse via JSON.parse directly without a transform step.

Korean example — field keys stay in English; only the content values are Korean.

// Cover
{ isTitleSlide: true, section: "", title: "강연 제목", subtitle: "부제목",
  meta: "날짜 | 주최", visualImage: "../assets/images/lecture-hall-professional.jpg",
  backgroundImage: "../assets/images/bg-deck.jpg" }

// Speaker intro (visualImage → portrait avatar on profile slides)
{ isProfileSlide: true, section: "INTRODUCTION", title: "강연자 소개",
  speakerName: "이름", speakerTitle: "직책 / 소속", speakerBio: "약력 (2-3줄)",
  visualImage: "../assets/images/speaker-portrait.jpg" }

// Divider (part break)
{ isDividerSlide: true, section: "섹션명", partNum: "PART 01",
  title: "파트 제목", desc: "이 파트에서 다룰 내용 한 줄 요약",
  visualImage: "../assets/images/ai-transformation-abstract.jpg",
  backgroundImage: "../assets/images/bg-deck.jpg" }

// Standard slide (image)
{ section: "섹션명", title: "슬라이드 제목",
  bullets: ["불릿 1", "불릿 2", "불릿 3"],
  visualImage: "../assets/images/data-analysis-dashboard.jpg" }

// Standard slide (text panel — structured visualDisplay)
// visualDisplay supports structured rendering via renderVisualDisplay():
//   [Box Title]  → .visual-heading (bold, accented)
//   ✓ / → / •    → .visual-item .visual-item-check (list marker)
//   (default)    → .visual-paragraph (normal text)
{ section: "섹션명", title: "슬라이드 제목",
  bullets: ["불릿 1", "불릿 2"],
  visualTitle: "핵심 포인트", visualDisplay: "[현재 상황]\n✓ 항목 1\n✓ 항목 2\n\n[개선 방향]\n→ 방향 1\n→ 방향 2" }

// Contact (last slide)
{ isContactSlide: true, section: "CLOSING", title: "감사합니다",
  contactEmail: "email@example.com", contactLinkedIn: "linkedin.com/in/...",
  contactPhone: "010-XXXX-XXXX" }

// Punchline (impactful closing)
{ isPunchlineSlide: true, section: "", title: "핵심 메시지" }

// Abbreviation footnotes (optional, any slide type)
// Renders as a small wrap-enabled line at the bottom-left of the slide
// (shared FootnoteBuilder — runs from initPPT, no per-theme work needed).
// Rule: define each abbreviation at its FIRST appearance per PART;
// skip divider/video slides and widely known terms (AI, company/model names).
{ section: "섹션명", title: "슬라이드 제목", bullets: ["불릿 1"],
  footnotes: ["SMR: 소형모듈원전(Small Modular Reactor)", "EREV: 주행거리 연장형 전동화(Extended-Range Electric Vehicle)"] }

Local video playback (videoLocal emission, U-20261116-009): when a slide carries videoId and the pool file deliverables/assets/videos/yt-<videoId>.mp4 exists (pool checked before injection), write "videoLocal": "../assets/videos/yt-<id>.mp4" on that slide in slidedata.json; otherwise omit the field — the YouTube embed fallback stays automatic (the native VideoSlide prefers videoLocal and falls through to YouTube on error). Injector bindings are index-based and regenerate on every build: build-theme-deck.ts auto-runs the idempotent inject-video-players.ts after every successful build (U-20261105-007), so a rebuild never needs manual re-binding.

Use design_spec.md's CSS variables directly. Unify slide rendering through a single renderSlide(data) function. Do not hardcode color or font values.

Theme + Style injection (from lecture-profile.md → presentation.theme + presentation.style):

<html lang="ko" data-theme="pitch-enhanced" data-style="premium-dark">
<link rel="stylesheet" href="../../docs/html-themes/styles/base.css">
<link rel="stylesheet" href="../../docs/html-themes/styles/premium-dark/style.css">

Available themes: outline | pitch | pitch-enhanced | vertical | zen. Available styles: classic | minimal | visual-heavy | academic | premium-dark. Defaults: pitch-enhanced + premium-dark.

Deterministic Builder (Task 4 — pending implementation): A CLI build-theme-deck.ts will automate CSS injection, marker replacement, and ppt-engine.js inlining. Once available, html-build will invoke the builder instead of performing these steps manually. The builder handles: theme/style resolution, package validation, INJECT marker replacement, CSS link generation, ppt-engine.js inlining, strict-JSON slideData injection. html-build remains responsible for: slide content generation, image path binding, narration/auto-advance config assembly, and renderSlide() (template-provided).

Theme capabilities:

Narration and auto-advance config injection (from lecture-profile.md → narration + auto_advance sections):

Read the narration and auto_advance blocks from lecture-profile.md and inject two independent config objects into the initPPT() call. This bridges lecture profile settings to the runtime NarrationEngine v2.3:

// Inject before the DOMContentLoaded listener or alongside initPPT call
var narrationConfig = {
  enabled: true,
  autoPlay: false,
  defaultLanguage: 'ko',
  scriptLanguage: 'ko',
  languages: ['ko']
};
var autoAdvanceConfig = {
  enabled: true,
  startAsAuto: false,
  interval: 8
};
initPPT({ transition: 'fade', showTimer: true, showThumbnails: false,
          narration: narrationConfig, autoAdvance: autoAdvanceConfig });

Image paths: Photos live in the shared pool at deliverables/assets/images/. Use ../assets/images/<slug>.<ext> (relative from deliverables/<project>/). Slug is the path field basename from image-manifest.json. No slide-number prefix. Diagrams (SVG/PNG) live in the shared pool at deliverables/assets/diagrams/. Use ../assets/diagrams/<stem>.png for diagram slides. Paths are auto-rewritten by gen-visual-images.ts when run.

Canonical rebuild order (U-20261105-007): every rebuild follows build → style patch → video inject — a rebuild silently drops video players and style patches otherwise. build-theme-deck.ts runs the video injection itself after a successful build (idempotent, video-less decks untouched); pass --download-videos to pre-fetch the deck's YouTube videos into deliverables/assets/videos/yt-<id>.mp4 before injection so offline playback binds local files. Re-apply the style patch after every rebuild.

Font Parity (PDF ↔ HTML) — mandatory

A deck's typography has ONE source of truth: the font family the PDF engine

loads from deliverables/assets/fonts/ (currently Pretendard-Regular/Bold.ttf,

per gen-slides-pdf.ts --font-dir default). Every HTML build MUST:

  1. Embed that same family via @font-face from those same TTF files (CSS url

relative to the stylesheet's own location) and set it FIRST in --font-family.

  1. Keep system-font fallbacks (Noto Sans KR, Apple SD Gothic Neo) as resilience

only — they are never the delivered look.

  1. Verify before hand-off: Playwright document.fonts.check('400 16px <Family>')

and document.fonts.check('700 24px <Family>') must both be true.

Any typography change (family, weights, font files) updates the PDF engine and

the HTML theme/patch in the SAME change (spec activity per ADR-0074).

Design: docs/designs/2026-11-10-font-parity-ssot-principle-design.md; gate

record: decisions/gates.yaml DG-DECK-06 (S10 sample review).


Stage 6: Image Binding

Read image-manifest.json and bind downloaded images to matching slideData entries by slide index. For slides where no image was found by the Image Curator:

Background image binding (when lecture-profile.md → background_image.enabled is true):

  1. Read background_image config from lecture-profile.md
  2. Read the global background image path from image-manifest.json → background_image.path
  3. Convert to relative path: ../assets/images/<slug>.<ext>
  4. Inject backgroundImage field into slideData entries based on scope:
  1. The template's renderSlide() reads data.backgroundImage and sets --slide-bg-image CSS variable (consumed by visual-heavy/style.css for full-bleed backgrounds)

Stage 7: Balance Check

Self-check after generating the HTML:

If any issue, split or merge slides.


Stage 8: Special Pages

Insert if either is missing. Populate with instructor fields from lecture-profile.md.

To open HTML locally: bunx serve . → http://localhost:3000


Chapter Backdrop Groups (U-20261114-011)

background_image.chapters[] in image-manifest.json maps chapter → pool slug

({chapter, slug}); the chapter's content slides bind that slug's file as

their per-slide background, and validate-image-manifest exempts the registered

group from the duplicate-content rule (partial registration still errors).

When content-slide backgrounds are appropriate vs the global backdrop: use

chapter backdrops when each chapter carries its own visual identity (a section

photo that recurs across that chapter's content slides) — register the group

rather than copying one global image everywhere. Use the global backdrop

(background_image.path + scope) only when ONE image is intentionally the

whole deck's backdrop. Chapter backdrops pair with the storyline)s chapter

structure: the slug names the chapter, so a restructure that moves slides

between chapters re-registers the mapping instead of silently misfiring

slide-index selectors.


Patch-Layer Convergence Doctrine (U-20261114-012)

Deck CSS/JS patch layers (style patches, player injectors, fit correctors) must be

CONVERGENT — re-running a patch must approach a fixed point, never oscillate.

from inputs the write cannot change (containers, stable siblings, padding, gaps,

margins) — never from the mutated element's own post-write metrics. A clear branch

conditioned on state its own pin branch created is a permanent two-state oscillation

(observed defect class: 25/57 visual slides shaking in one deck, rev5 zen-visual fit).

pin, or read a container that the pin cannot resize.

tested (tests/inject-video-players.test.ts 're-injection is byte-identical'); any

new patch-layer tool ships the same pin.

to the shared patch layer (or the template tool) before the next deck uses it;

per-deck copies of a shared injector diverge silently.

scripts/co-deck/patch-zen-white-bubble.ts (`--project/--version/--accent/

--accent-light`) is the layer — new zen decks run IT, they never copy it into

the project. A deck-local fix promotes in three steps: (1) fix the deck-local

copy and verify convergence (0 oscillating slides); (2) parameterize the fix

into the shared patcher with a version bump (deck-specific constants become

flags); (3) the shared patcher rides the next project→template backport gate.

If a fix cannot be parameterized, it stays deck-local and is re-assessed at

the next rebuild.


Output Format

lecture_[topic]_v1.html — single self-contained HTML file with embedded const slideData (strict JSON), theme data-theme attribute, base + override CSS links; photos and diagrams live in the shared pools deliverables/assets/images/ + deliverables/assets/diagrams/ (bound deck-relative as ../assets/…).

PDF pipeline note: scripts/co-deck/extract_slidedata.mjs parses the inline const slideData = [...] array via a bracket-depth state machine (not regex, not DOM). The slideData array MUST be strict JSON — all keys double-quoted, string values double-quoted, no trailing commas, no JS comments, no single quotes. Non-JSON syntax will break the PDF pipeline.

Encoding: All output HTML files MUST be UTF-8 without BOM. Verify <meta charset="UTF-8"> is present in <head>. On Korean Windows systems, ensure chcp 65001 is active before writing files to prevent CP949 corruption of Korean text content.

Builder Boundary: See agents/html-build.md "Builder Boundary" section for the complete responsibility split between the builder and the html-build agent.

Related Skills

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.