text_diff
Compare two text inputs and report line-level differences using LCS. Options for unified, side-by-side, or inline views, with optional case or whitespace normalization.
Instructions
Text Diff. Compare two text inputs and report every line-level difference using an LCS algorithm. Choose a view via diffType: 'unified' (single change list), 'side-by-side' (paired left/right lines), or 'inline'. Optional ignoreCase and ignoreWhitespace normalize before comparing. Use this for plain-text/code comparison; use file_comparer for the same diff over uploaded files, and text_find_replace to substitute matches rather than view changes. Pure local compute: read-only, non-destructive, offline, and rate-limited (60 requests/min for anonymous callers). Returns the diff segments plus per-text and change statistics.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| text1 | Yes | First (original/left) text; compared line by line against text2. | |
| text2 | Yes | Second (modified/right) text; differences are reported relative to text1. | |
| diffType | No | Output shape of the diff segments; any other value falls back to unified. | unified |
| ignoreCase | No | Lowercase both texts before comparing so case differences are not reported. | |
| ignoreWhitespace | No | Trim and collapse runs of whitespace before comparing so spacing differences are not reported. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| success | No | Always true on success. | |
| diff | No | Ordered diff segments; field set varies by diffType (unified adds prefix/lineNumber/text, side-by-side adds line1/line2/text1/text2, inline adds text). | |
| stats | No | Size metrics for each input and a change tally. |