Line mode uses jsdiff 9 structuredPatch(), which runs the library's Myers-family shortest-edit implementation over line tokens. Context length changes only how much unchanged material appears around a hunk; it does not alter which lines compare equal.
Raw added and removed counts come directly from '+' and '-' patch lines. A contiguous removal block and addition block are paired by position for the side-by-side modified-row display. Those paired rows are a visual alignment aid, while the unified patch retains the independent additions and removals.
Ignore line-edge whitespace maps to jsdiff's ignoreWhitespace option, which trims each line only for equality. Treat CRLF as LF maps to stripTrailingCr, which removes one CR immediately before LF. Neither option mutates the text fields.
Unified output names the inputs before.txt and after.txt, emits standard file headers and hunk ranges, and retains the `\ No newline at end of file` marker. Filtering options can make that output unsuitable as an exact patch because intentionally ignored differences are absent.
Character mode uses diffChars(), where a character is a Unicode code point rather than a UTF-16 code unit. It aligns shifted content correctly, but does not segment extended grapheme clusters; a visible emoji or accented letter can contain multiple compared units.
Each side is limited to 2 MiB of UTF-8. Line mode allows at most 100,000 line tokens, character mode at most 100,000 code points, computation is bounded to 1,500 ms and edit distance 20,000, line previews to 2,000 rows, and character previews to 50,000 displayed code points. Exceeding a computation budget produces an error, never a fabricated whole-file replacement.