# Text Diff Zero-dependency text/file diff (unified, context, side-by-side, HTML). ``` python scripts/run.py old.txt new.txt python scripts/run.py old.txt new.txt -m side -w 50 python scripts/run.py old.txt new.txt -m context -n 5 python scripts/run.py old.txt new.txt -m html > diff.html cat new.txt | python scripts/run.py old.txt - ``` Built on stdlib `difflib`. --- name: text-diff display_name: Text Diff description: "Show a unified, context, side-by-side, or HTML diff between two texts or files. Triggers: diff text, compare files, text diff, side by side diff, unified diff." --- # Text Diff Compare two pieces of text or two files and show what changed. ## When to use The user has two versions of some text/code/file and wants to see the changes — as a unified patch, a context diff, a side-by-side view, or an HTML report. ## How to use Run `scripts/run.py` with two inputs: - `python scripts/run.py old.txt new.txt` — unified diff (default). - `python scripts/run.py old.txt new.txt -m side` — side-by-side columns. - `python scripts/run.py old.txt new.txt -m context -n 5` — context diff, 5 lines. - `python scripts/run.py old.txt new.txt -m html > diff.html` — HTML report. One input may be stdin via `-`, e.g. `cat new.txt | python scripts/run.py old.txt -`. ## Pitfalls - Only ONE of the two inputs can be `-` (stdin); using `-` twice errors. - Exit code is 1 when the files differ, 0 when identical (diff/grep convention). - Side-by-side truncates long lines to `--width` (default 40) columns.
Text Diff by langbot-team
Show a unified, context, side-by-side, or HTML diff between two texts or files.
Loading...