Redlines is a Python library that compares two strings or blocks of text, producing human-readable differences or 'deltas' similar to Microsoft Word's track changes. It provides structured output showing detailed change information, positions, and statistics, supporting various formats like JSON (default for CLI), Markdown, HTML, and rich terminal display. The current version is 0.6.1, and the project exhibits an active release cadence.
pip install redlinesVerified import paths — ran on the pinned version, not inferred.
Instantiate the `Redlines` class with two strings to compare. The class provides methods like `output_markdown`, `output_json`, and `output_rich` for different output formats. The `compare` method can be used for subsequent comparisons against the initial 'old' text.
Review the official 'Agent Integration Guide' or run `redlines --help` for the new CLI syntax. Expect JSON output by default when calling `redlines "old text" "new text"`.
Verify the PyPI page and documentation to confirm `redlines` (pypi.org/project/redlines) is the correct library for generic text comparison, not `.docx` files.
Install the library with the appropriate extra, e.g., `pip install redlines[nupunkt]` to access `NupunktProcessor` for advanced tokenization.