# Generation Modes ## Step 1: Determine Output Location 1. Check if there's an active plan context (from `## Plan Context` in hook injection) 2. If active plan exists: save to `{plan_dir}/visuals/{topic-slug}.md` 3. If no active plan: save to `plans/visuals/{topic-slug}.md` 4. Create `visuals/` directory if it doesn't exist ## Step 2: Generate Content **Mermaid Diagram Syntax:** When generating mermaid code blocks, use `/ck:mermaidjs-v11` skill for v11 syntax rules. **Essential rules (always apply):** - Quote node text with special characters: `A["text with /slashes"]` - Escape brackets in labels: `A["array[0]"]` Use the appropriate template based on flag: ### --explain (Visual Explanation) ```markdown # Visual Explanation: {topic} ## Overview Brief description of what we're explaining. ## Quick View (ASCII) [ASCII diagram of component relationships] ## Detailed Flow [Mermaid sequence/flowchart diagram] ## Key Concepts 1. **Concept A** - Explanation 2. **Concept B** - Explanation ## Code Example (if applicable) [Relevant code snippet with comments] ``` ### --slides (Presentation Format) ```markdown # {Topic} - Visual Presentation --- ## Slide 1: Introduction - One concept per slide - Bullet points only --- ## Slide 2: The Problem [Mermaid flowchart] --- ## Slide 3: The Solution - Key point 1 - Key point 2 --- ## Slide 4: Summary Key takeaways... ``` ### --diagram (Focused Diagram) ```markdown # Diagram: {topic} ## ASCII Version [ASCII architecture diagram] ## Mermaid Version [Mermaid flowchart/graph] ``` ### --ascii (Terminal-Friendly Only) ``` [ASCII-only box diagram with legend] ``` ## Step 3: Save and Preview 1. Write generated content to determined path 2. Start preview server with the generated file: ```bash node .opencode/skills/markdown-novel-viewer/scripts/server.cjs \ --file "" --host 0.0.0.0 --open --foreground ``` ## Step 4: Report to User Report: - Generated file path - Preview URL (local + network) - Remind: file saved in plan's `visuals/` folder for future reference --- ## HTML Mode Generation When `--html` flag is present (or implied by `--diff`, `--plan-review`, `--recap`), generate self-contained HTML instead of Markdown. ### HTML Step 1: Determine Output Location - Same plan-aware logic as markdown mode but with `.html` extension - Active plan: `{plan_dir}/visuals/{topic-slug}.html` - No plan: `plans/visuals/{topic-slug}.html` - Create `visuals/` directory if needed ### HTML Step 2: Read References Always read `html-design-guidelines.md` first (anti-slop rules, style presets). Then read mode-specific references: | Mode | References | Templates to study | |------|------------|-------------------| | --html --explain | html-css-patterns.md, html-libraries.md | architecture.html | | --html --diagram | html-css-patterns.md, html-libraries.md | mermaid-flowchart.html or architecture.html | | --html --slides | html-slide-patterns.md, html-css-patterns.md, html-libraries.md | slide-deck.html | | --html --diff | html-css-patterns.md, html-libraries.md | data-table.html, architecture.html | | --html --plan-review | html-css-patterns.md, html-libraries.md | architecture.html, data-table.html | | --html --recap | html-css-patterns.md, html-libraries.md | architecture.html, data-table.html | For multi-section pages (explain, diff, plan-review, recap): also read `html-responsive-nav.md`. ### HTML Step 3: Generate Content Follow the 4-phase workflow: **Think:** Determine content-type routing: - Mermaid for topology (flowcharts, sequence, ER, state, mind maps, class, C4) - CSS Grid for text-heavy architecture (cards with descriptions, code references) - HTML `` for data (requirement audits, comparisons, matrices) - Chart.js for real charts (KPI dashboards, sparklines) - Hybrid for complex systems (15+ elements): simple Mermaid overview + detailed CSS Grid cards **Structure:** Pick template pattern, plan sections, assign depth tiers (hero/elevated/default/recessed). **Style:** Select font pairing + palette from curated presets. Vary from previous outputs. Apply anti-slop checks: - No Inter/Roboto/system-ui alone as body font - No indigo/violet (#8b5cf6, #7c3aed) as accent - No animated glowing box-shadows - No gradient text on headings - No emoji icons in section headers - No three-dot window chrome on code blocks **Deliver:** Write single self-contained `.html` file — all CSS and JavaScript inline. External resources: CDN only (Google Fonts, Mermaid.js v11, Chart.js, anime.js). **MANDATORY — Theme Toggle:** Every HTML page MUST include the light/dark theme toggle button from `html-css-patterns.md` → "Theme Toggle Button" section. This is non-negotiable. The toggle button (`