---
id: 7fa9434e-8f1f-4e63-8236-c039237b073a
title: 'Diffs: per-file cards, dual line numbers, visual diffstat, drop mbox preamble'
state: closed
labels:
- ui
assignees: []
milestone: null
created: 2026-10-27T15:27:50.501775126Z
updated: 2026-10-27T16:25:41.909511687Z
---
Commit detail and PR patch sections dump raw `git show` / `git format-patch` output into one `<pre>`. This is where GitHub/GitLab/Forgejo look most polished and we look like `less`.

### Current
Commit page (`commit/<sha>.html`):
```
commit ec5b1f0bcaeacfd169d48a27bee83a414a639e46
Author: gl0w <gl0w@world>
Date:   Thu Sep 10 05:26:49 2026 +0100

    land #7 forge-readers + f0rge state

diff --git a/.forge/issues/f8c1…/issue.md b/.forge/issues/f8c1…/issue.md
index 2a46910..97d6ad7 100644
--- a/…
+++ b/…
@@ -1,13 +1,13 @@
```
PR page patch starts with the mbox preamble `From 4eabe68… Mon Sep 17 00:00:00 2001`, `From:`, `Subject: [PATCH] …`, then a text diffstat (`src/commits.rs | 30 +++++…`).

Problems:
1. No per-file grouping/cards — one giant block.
2. No line numbers (neither old nor new side).
3. `diff --git` / `index` / `---` / `+++` are colored with `--diff-file`, which equals `--fg` → visually indistinguishable from body text.
4. Hunk headers (`@@ … @@`) are plain; no function context emphasis.
5. Long paths wrap mid-token instead of scrolling per file.
6. Mbox/patch preamble is pure noise on the PR page.
7. Commit header (`Author:`, `Date:`) duplicates the meta shown above the diff.

### Scope
- Emit **one card per file**: sticky file header (path, `+n −m` counts in green/red, "view file" link), collapse-all via `<details open>`.
- **Two-column line numbers** (old/new) in a gutter, `--fg-dim`, `user-select:none`, monospace alignment with the code lines.
- **Diffstat bar**: a real visual bar (green/red proportional divs) replacing `++++---` ASCII.
- Color `---`/`+++`/`diff --git` with a distinct `--diff-file` token (not `--fg`), hunk headers `--diff-hunk` on a `--surface-2` strip.
- Strip the `From …` mbox preamble and `From:`/`Subject:` lines on the PR page (they duplicate the PR title); keep the commit message body only.
- Per-file horizontal scroll (`overflow-x:auto`) instead of wrapping paths.
- Rust: `commits.rs` already emits `diff-file`/`diff-hunk` spans; extend to file boundaries + line numbers rather than re-parsing.

### Acceptance
- [ ] every changed file renders as its own card with path + counts
- [ ] old/new line numbers align with code lines
- [ ] `diff --git`/`---`/`+++` visibly distinct from code text
- [ ] PR patch has no mbox preamble
- [ ] no mid-token wrapping of long paths (scroll instead)
