Skip to content

Latest commit

Β 

History

History
72 lines (44 loc) Β· 1.18 KB

File metadata and controls

72 lines (44 loc) Β· 1.18 KB

textdiff

textdiff is a lightweight and expressive Go library for comparing two texts and generating inline diffs in a Git-style format. It highlights added and removed words, making it ideal for applications like text editors, document review tools, and change tracking systems.


✨ Example

package main

import (
    "fmt"
    "textdiff/diff"
)

func main() {
    a := "my name is John and I like apples"
    b := "my name is Josh and I love oranges"

    result := diff.CompareTexts(a, b)
    fmt.Println(result)
}

πŸ–¨οΈ Output

my name is [-John-] {+Josh+} and I [-like apples-] {+love oranges+}

πŸ“¦ Installation

Add the module to your Go project using:

go get github.com/laviodias/textdiff/diff

πŸ§ͺ Tests

Run tests with:

go test ./...

πŸ“œ License

MIT License. See the LICENSE file for details.


🀝 Contributing

Contributions are welcome! Please open issues or pull requests for suggestions or improvements.


🌐 Package Documentation

Documentation available at: