Text Diff
See exactly what changed in your prompt
You've been there: a friend sends an updated workflow, your favorite prompt changed subtly, and you stare at two blocks of text trying to spot the one word that flipped. Text Diff is the node that ends that game. Feed it two strings and it renders a GitHub-style diff right inside the node - line numbers, added lines in green, deleted lines in red, and character-level highlighting on the lines that changed. It's the ComfyUI equivalent of running git diff, minus the terminal.
It slots into the same quality-of-life corner of the ecosystem that rgthree and friends occupy: nothing it produces is a tensor, it never touches a checkpoint, and it will never be in a showcase. It's a utility you install once and quietly rely on. The pack is a single node, one initial commit, and its selling point is that it's boring in exactly the right way - no API, no model downloads, no GPU.
How it works
The diff engine is pure Python difflib with autojunk=False so it doesn't skip "junk" lines that actually matter. It splits both texts into lines, runs a SequenceMatcher, then runs a second, word-level pass on replaced lines so you see exactly which words changed rather than a whole red/green line. The formatter turns that into two complete HTML documents - one unified view, one side-by-side - and the included JS extension renders whichever you picked into an iframe inside the node.
Two details are worth knowing because they're the difference between "oh nice" and "this is broken":
- Both HTML views are computed on every run, so flipping
view_modein the dropdown switches instantly without re-queueing. That's the feature the README is proudest of and it genuinely works. - The node persists the rendered HTML into your workflow's metadata, so reopening a saved workflow shows the diff again instead of an empty box.
The inputs that matter
There are only four, and you'll realistically touch two. text_a and text_b are the original and modified text (both required, multiline). Note the gotcha: both are marked forceInput in the source, meaning there's no text box on the node - you wire them from other nodes. That trips up beginners constantly. You need a text source like a Show Text node, an LLM-in-ComfyUI output, or another prompt node feeding each input.
The two you'll actually set:
- view_mode -
side_by_side(default) orunified. Try unified first; it reads better for long prompts. - context_lines - lines of surrounding context to show around each change. Default is
-1, which means "show everything." Set it to2or3to focus on just the changes.
It has no outputs and nothing to wire onward - it's an output node whose job is showing you the answer, not passing it on.
Installing it
ComfyUI Manager is easiest: search for ComfyUI_text_diff and install. Manual is the same one-liner as always:
cd ComfyUI/custom_nodes
git clone https://github.com/dcyd-lun/ComfyUI_text_diff
Then restart ComfyUI. The requirements file is a comment - this pack needs only the Python standard library, so there are no dependency conflicts to fight and no models to place.
Where people get burned
- You can't type into the inputs.
forceInputmeans text must come from a connection. If the node looks "empty" and you can't figure out why, that's it - drag a text output in. - The display doesn't appear after install. Because the rendering is a JS extension, it loads at startup. If you installed while ComfyUI was running, restart fully (a hard refresh of the browser tab doesn't hurt either). After that it shows up on run.
- Identical texts show nothing useful. That's not a bug - zero changes means a clean, all-unchanged diff. It also means this node doubles as a quick sanity check that two values actually differ.
It's a small tool for a small job, but once you're diffing prompt versions or comparing two LLM outputs, you'll wonder why you spent so long squinting before.
Inputs (4)
| Name | Type | Default | Description |
|---|---|---|---|
| text_a | STRING | — | |
| text_b | STRING | — | |
| view_modeopt | COMBO | side_by_side | 2 options: side_by_side, unified |
| context_linesopt | INT | -1-1–50 | Lines of context around changes (-1 = show all) |
Outputs (0)
No outputs