textdiff

command module
v0.0.0-...-9ab836e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 7, 2025 License: MIT Imports: 2 Imported by: 0

README

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:

https://pkg.go.dev/github.com/laviodias/textdiff

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL