# Components for an explain-diff page Every snippet below is styled by `assets/template.html`. Copy, then replace the sample content. Keep the class names: the stylesheet and the checker know them. Sample text is in English; write yours in the page language. ## Skippable deep background The newcomer's tour of the system goes in a collapsible block, so a reader who knows it can jump straight to the narrow background. ```html
How the hint service works (skip if you know it)

…

``` ## Callouts Three kinds: `concept` (a definition or key idea), `edge` (an edge case worth remembering), `risk` (what can still go wrong, or a follow-up). ```html ``` ## Flow of components Nodes left to right, an `arrow` between each pair. Its label carries the example data that travels (a call, a payload, a return value). `hl` marks the component the change touches. On a phone the flow turns vertical. ```html
Browser guest g-42, no session
ensureGuest()
fetchHint new: session first
rpc hint(day=12)
Database auth-gated RPC
After the fix: the session exists before the hint call.
``` A return value travels back through the label of the same arrow (`hint(day=12) → "starts with B"`) or through a second flow below. ## Row of states Same markup with `state` nodes; `hl` marks the state the change adds. ```html
running
crash ×3
stopped new: final
``` ## Before and after ```html

Before

…

After

…

``` ## Simplified UI mock For UI changes: draw only what the user sees that matters, as boxes. `mark` outlines the element the change affects. Put two mocks inside the panes of a `compare` block for a before and after view. ```html
Daily puzzle · day 12

Find the word in 6 tries.

B _ _ _ _
Hint
Hint unavailable
``` `mock-alert ok` gives the success colour. ## Toy data ```html
VisitorSessionHint
g-42nonerefused
``` ## Code excerpt and diff Show only the lines that matter, with the `path:line` above. Escape `<`, `>` and `&` in every code block. ```html
apps/web/src/game/daily.ts:31
export async function fetchDailyHint(day: number) {
  const ok = await ensureGuestSession();
  if (!ok) return null;
}
The session comes first; a failure ends in null.
``` A diff block holds raw unified-diff lines; the template's script colours the `+`, `-` and `@@` lines. Keep the leading `+` / `-` / space. ```html
apps/web/src/game/daily.ts
@@ -28,6 +28,9 @@ export async function fetchDailyHint
 export async function fetchDailyHint(day: number) {
+  const ok = await ensureGuestSession();
+  if (!ok) return null;
   return rpc("hint", { day });
``` ## Quiz data The template renders the quiz from the JSON block `quiz-data`. Five questions, three or four options each, exactly one `"correct": true`, and a `why` on every option. Backticks in any string render as inline code. Plain text only, no HTML; write `<\/` for any `