diff --git a/.github/alto-code-diff.svg b/.github/alto-code-diff.svg new file mode 100644 index 0000000..6c5b60a --- /dev/null +++ b/.github/alto-code-diff.svg @@ -0,0 +1,16 @@ + + + ALTO Code Diff + Install with composer require alto/code-diff. + + + diff --git a/README.md b/README.md index 10a0459..e2cddce 100644 --- a/README.md +++ b/README.md @@ -1,51 +1,21 @@ -# Alto Code Diff +

+ + ALTO Code Diff + +

A modern PHP library to generate, render and apply diffs, featuring advanced algorithms, versatile rendering, and full patching support. --- -  [![PHP Version](https://img.shields.io/badge/PHP-8.3+-1e40af?logoColor=white&labelColor=000)](https://github.com/altophp/code-diff) -  [![CI](https://img.shields.io/github/actions/workflow/status/altophp/code-diff/CI.yml?branch=main&label=Tests&logoColor=white&logoSize=auto&labelColor=000&color=2563eb)](https://github.com/altophp/code-diff/actions) -  [![Packagist Version](https://img.shields.io/packagist/v/alto/code-diff?label=Stable&logoColor=white&logoSize=auto&labelColor=000&color=4ba3f7)](https://packagist.org/packages/alto/code-diff) -  [![GitHub Sponsors](https://img.shields.io/github/sponsors/smnandre?logo=github-sponsors&logoColor=4ba3f7&logoSize=auto&label=%20Sponsor&labelColor=000&color=2979ff)](https://github.com/sponsors/smnandre) -  [![License](https://img.shields.io/github/license/altophp/code-diff?label=License&logoColor=white&logoSize=auto&labelColor=000&color=1e40af)](./LICENSE) - -## Features - -### Advanced Diff Algorithms - -- **Myers Diff Algorithm (default)**: Fast and accurate line-by-line and word-by-word diffing (O(ND)). -- **LCS Diff Algorithm**: Opt-in Longest Common Subsequence engine (O(MN) time and memory) for deterministic academic use cases. -- **Binary Detection**: Automatic detection and rejection of binary content. - -### Versatile Rendering - -Visualize and format diffs for any output medium: - -#### HTML Output - -![HTML Preview](docs/assets/html-preview.svg) - -#### ANSI Side-by-Side - -![ANSI Preview](docs/assets/side-by-side-preview.svg) - -### Full Patching Support - -- **Unified Diff Parsing**: Parse standard unified diff patches into objects. -- **Patch Application**: Apply patches to files with "fuzz" factor support. -- **Multi-file Bundles**: Handle complex patches affecting multiple files. - -## Requirements - -- PHP 8.3 or higher - -## Installation - -```bash -composer require alto/code-diff -``` +

+ PHP Version + CI + Packagist Version + GitHub Sponsors + License +

## Quick Start @@ -120,6 +90,42 @@ $renderer = new AnsiSideBySideRenderer( echo $renderer->render($result); ``` +## Features + +### Advanced Diff Algorithms + +- **Myers Diff Algorithm (default)**: Fast and accurate line-by-line and word-by-word diffing (O(ND)). +- **LCS Diff Algorithm**: Opt-in Longest Common Subsequence engine (O(MN) time and memory) for deterministic academic use cases. +- **Binary Detection**: Automatic detection and rejection of binary content. + +### Versatile Rendering + +Visualize and format diffs for any output medium: + +#### HTML Output + +![HTML Preview](docs/assets/html-preview.svg) + +#### ANSI Side-by-Side + +![ANSI Preview](docs/assets/side-by-side-preview.svg) + +### Full Patching Support + +- **Unified Diff Parsing**: Parse standard unified diff patches into objects. +- **Patch Application**: Apply patches to files with "fuzz" factor support. +- **Multi-file Bundles**: Handle complex patches affecting multiple files. + +## Requirements + +- PHP 8.3 or higher + +## Installation + +```bash +composer require alto/code-diff +``` + ## Configuration Options ### Context Lines