--- title: "Diff" description: "Render structured diffs with line-level semantic markup — added, removed, context, hunk." section: vault prev-url: "status/" prev-title: "Status" next-url: "session/" next-title: "Session Log" type: vault date: 2026-04-09 tags: ["vault", "diff", "reference"] ai-disclosure: "generated" ai-model: "claude-sonnet-4-5" ai-provider: "Anthropic" --- ## Overview Use `data-diff` on a `
` block to render a structured diff. Child elements carry line-level semantics.

```html
  @@ -12,7 +12,9 @@
   function greet(name) {
  -  return "Hello " + name;
  +  const greeting = `Hello, ${name}!`;
  +  return greeting;
   }
``` ## Line Types | Value | Meaning | |-------|---------| | `hunk` | Hunk header (`@@ ... @@`) — muted, italic | | `context` | Unchanged surrounding line — default text | | `removed` | Deleted line — red background, `-` prefix | | `added` | New line — green background, `+` prefix | ## Inline Diffs For single-value changes in prose, use `data-diff` directly on `` and ``: ```html

Latency changed from 240ms to 18ms after the index rebuild.

``` ## Notes The `data-diff` block expects monospace rendering. ASW applies `font-family: var(--asw-font-mono)` automatically — no additional class needed.