Skip to content

Diff diagrams

Best for explaining what changed — a code review companion, a migration note, a “here’s the fix” walkthrough. There’s no special syntax: paste git diff output into a ```diff fence and it renders as a diff card.

Diff rendered by vizzy

```diff
--- a/src/auth.ts
+++ b/src/auth.ts
@@ -12,5 +12,6 @@ export async function login(email: string) {
const user = await findUser(email)
if (!user) throw new NotFoundError(email)
- const token = sign(user.id)
+ const token = sign(user.id, { expiresIn: '1h' })
+ await audit.log('login', user.id)
return respond(token)
}
```

The format is the standard unified diff, exactly as git diff emits it:

  • diff --git / index / mode lines are understood; --- / +++ name the file (the a/ / b/ prefixes are stripped), @@ headers set the line numbers, and + / - / space lines are the content. Multiple files in one fence each get their own card.
  • The header chip shows the path with +N −M stats, and labels new files (/dev/null old path), deletions, renames (old → new), and Binary files … differ entries.
  • Word-level highlights: paired removed/added lines are diffed token-by-token, so the exact changed words carry a stronger wash — the whole row tint shows where, the highlight shows what.
  • Nothing is fatal: a bare hunk with no file headers — or even bare +/- lines — still renders, and unknown metadata lines are skipped, never shown as errors.

A vizzy fence immediately after the diff opts into presentation extras:

```vizzy
title Deploy config bump
layout split
collapse 8
```
  • layout split renders side-by-side old/new columns instead of the unified stack — context lines span both sides, and each change block’s removed/added lines pair up row by row. layout unified switches back.
  • collapse 8 folds unchanged context runs longer than 8 lines into a ”⋯ N unchanged lines” pill, keeping 3 lines of context around each change — so a whole-file diff pastes without bloating the canvas.
  • title and desc label the card, as on any diagram.

A ```diff fence is already standard Markdown: GitHub and every other Markdown host render it as a red/green-tinted code block, so the file stays fully readable outside vizzy — no special syntax to degrade.