You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docs(readme): lead with the product, add a live demo link and sample
Rewrite the README around the name and tagline: a prominent live-demo
link and license badge up top, a real sample of the exported diff
image, benefit-framed features, and an honest note that inline token
diffing suits localized edits over full rewrites.
Turn a before/after code snippet into a single clean image of just the change.
9
+
Paste the old code, paste the new code, get a token-level diff styled like a tidy
10
+
editor window and sized for a tweet. No login, no export dialog, nothing uploaded.
4
11
5
-
Paste a before/after code snippet, get back a single crisp image of just the diff —
6
-
styled like a nice editor, sized for a tweet, no login, no export dialog.
12
+

7
13
8
-
## Why
14
+
## Who it's for
9
15
10
-
Sharing a code change on Twitter/Slack usually means a screenshot of a diff view that's
11
-
either too cluttered (line numbers, gutter, full file chrome) or too crude (solid
12
-
red/green line highlighting that hides exactly which tokens changed). Tools like
13
-
Snappify solve a bigger problem — window chrome, themes, gradients, carousels — for
14
-
people who need a lot of that. Most of the time you just want: paste old code, paste
15
-
new code, get one clean image with token-level highlighting, done.
16
+
Developers sharing a specific code change: a clever one-liner, a bug fix, a small
17
+
refactor, dropped into a tweet, a PR description, or a Slack thread. Not slide decks or
18
+
blog carousels; that is a bigger tool's job. This is the "quote-tweet a diff" case:
19
+
fast, single-shot, disposable.
16
20
17
-
Diff Poster does the one thing: paste, render, download/copy. No account, no server
18
-
round-trip, no saved projects.
21
+
## Why token-level
19
22
20
-
## The wow moment
23
+
Most diff screenshots paint a whole changed line red or green. Rewrite
24
+
`return 'hi ' + name;` as ``return `hello, ${name}!`;`` and a line diff just says
25
+
"this line changed" while hiding what actually changed. Diff Poster diffs at the token
26
+
level (identifiers, operators, literals, strings), so only the swapped tokens are
27
+
marked. The reader sees the exact substitution, which is the whole reason to share it.
21
28
22
-
Paste two versions of a function into the two panes and instantly get a properly
23
-
highlighted diff image — token-level, not line-level — cropped and sized exactly for
24
-
pasting into a tweet or a Slack message.
29
+
Inline token diffing is at its best on localized edits. A wholesale rewrite (a
30
+
for-loop turned into a `reduce`) interleaves a lot of removed and added tokens, the
31
+
same way GitHub's word-diff does; the tool is tuned for the function-sized change, not
32
+
the full-file rewrite.
25
33
26
34
## Features
27
35
28
-
- Token-level diff highlighting (not whole-line red/green blocks) via a real diffing
29
-
algorithm over lexical tokens, so a renamed variable or a tweaked argument list reads
30
-
clearly instead of the whole line going red.
31
-
- Editor-style rendering: syntax highlighting, a monospace type stack, subtle line
32
-
numbers, rounded window chrome — looks like a screenshot from a nice editor, not a
33
-
raw `<pre>` block.
34
-
- Output sized for social sharing (1200×675, tweet/Slack-friendly) by default, with
35
-
the image rendered client-side onto a `<canvas>` and exported as PNG.
36
-
- One-click "Copy image" (Clipboard API, with a clearly-disabled fallback where it's
37
-
unsupported) and "Download PNG" — no export dialog, no intermediate screen.
38
-
- No login, no backend, no stored data: everything happens in the browser.
36
+
-**Token-level highlighting**, via a longest-common-subsequence diff over lexical
37
+
tokens, so a renamed variable or a tweaked argument reads clearly instead of the
38
+
whole line going red.
39
+
-**Editor-style output**: syntax coloring for JavaScript and Python, a plain-text
40
+
fallback, subtle line numbers, and rounded window chrome, so it reads as a
41
+
screenshot from a nice editor, not a raw `<pre>` block.
42
+
-**Sized for sharing** at 1200×675 (the 16:9 frame Twitter, Bluesky, and Slack use
43
+
for previews), rendered onto a `<canvas>` at your screen's pixel density so the PNG
44
+
stays crisp on retina displays.
45
+
-**One-click copy or download**: copy the PNG straight to your clipboard, or save it,
46
+
with no export dialog. Where the browser can't write images to the clipboard, Copy
47
+
is clearly disabled and Download always works.
48
+
-**Nothing leaves your browser**: tokenizing, diffing, and rendering all run
49
+
client-side. No account, no backend, no stored snippets.
39
50
40
51
## Usage
41
52
42
53
1. Paste the original code into the **Before** pane, the changed code into **After**.
43
-
2. Click **Generate image**.
44
-
3.**Copy image** or **Download PNG** — both one click, no dialog.
54
+
2. Pick the language (JavaScript, Python, or plain text) for syntax coloring.
55
+
3. Click **Generate image**.
56
+
4.**Copy image** or **Download PNG**, both one click, no dialog.
57
+
58
+
The download is named `diff-poster-YYYYMMDD-HHMMSS.png` so a folder of them sorts by
59
+
time.
45
60
46
-
## Stack
61
+
## How it works
47
62
48
-
Static, client-side JavaScript (no build-time server, no user accounts):
63
+
A static, client-only Vite app with no framework, plain DOM APIs over a handful of
64
+
pure modules:
49
65
50
-
- Vanilla JS + a small, focused diff library for token-level diffing.
51
-
-`<canvas>` for rendering the final shareable image.
52
-
- Vitest for unit tests (diff logic, tokenizer, layout math).
53
-
- Ships as a static site — no server required at runtime.
66
+
`tokenize` (text → tokens, with strings and comments atomic) → `diffTokens` (LCS over
67
+
the two token streams) → `segmentsToRows` + `fitRows` (row splitting and sizing math)
68
+
→ `classifyToken` (syntax category per token) → `renderDiffToCanvas` (window chrome,
69
+
line numbers, syntax + diff coloring) → `canvasToBlob` (PNG for copy or download).
54
70
55
-
See [`docs/VISION.md`](docs/VISION.md) for the full design rationale,
71
+
See [`docs/VISION.md`](docs/VISION.md) for the rationale,
56
72
[`docs/ARCHITECTURE.md`](docs/ARCHITECTURE.md) for the module map, and
57
-
[`docs/BACKLOG.md`](docs/BACKLOG.md) for the build plan.
73
+
[`docs/DESIGN.md`](docs/DESIGN.md) for the paper-and-ink design direction.
58
74
59
75
## Development
60
76
@@ -67,12 +83,13 @@ npm run lint # eslint
67
83
npm run build # static production build (output: site/)
68
84
```
69
85
70
-
## Status
71
-
72
-
The full v1 scope is built and tested: paste/diff/image, copy/download/share, a
73
-
language selector, large-input guardrails, and a full keyboard/accessibility pass.
74
-
See [`docs/BACKLOG.md`](docs/BACKLOG.md) for the story-by-story breakdown.
86
+
Unit tests (jsdom) cover the diff, tokenizer, layout math, canvas rendering, and
87
+
export; the Playwright suite covers the real-browser behavior jsdom can't: computed
88
+
focus rings, `prefers-reduced-motion`, layout overflow, and font-blocked degradation.
89
+
Both run in CI.
75
90
76
91
## License
77
92
78
-
MIT — see [`LICENSE`](LICENSE).
93
+
MIT. See [`LICENSE`](LICENSE).
94
+
95
+
More of Charlie's projects → https://apps.charliekrug.com
0 commit comments