An open API service indexing awesome lists of open source software.

https://github.com/jung-hunsoo/exdiff

Text difference library for Elixir
https://github.com/jung-hunsoo/exdiff

elixir hex

Last synced: 4 months ago
JSON representation

Text difference library for Elixir

Awesome Lists containing this project

README

          

# Exdiff

[![Hex.pm](https://img.shields.io/hexpm/v/exdiff.svg)](https://hex.pm/packages/exdiff)

Text difference library for Elixir

## Installation

Add `exdiff` to your `mix.exs` dependencies:

```elixir
def deps do
[{:exdiff, "~> 0.1.5"}]
end
```

## Quick example

```elixir
> Exdiff.diff("abd", "abcd")
%{html: "

ab
c
d
", length: 1}

> Exdiff.diff("abd", "abcd", wrapper_tag: "span")
%{html: "abcd", length: 1}

> Exdiff.diff_to_html("abd", "abcd")
{1, "

ab
c
d
"}

> Exdiff.diff_to_html("abd", "abcd", wrapper_tag: "span")
{1, "abcd"}
```

## Usage

There are three HTML classes wrapped with tag.

- `exdiff-del`
- `exdiff-ins`
- `exdiff-eq`

## Test

`mix test`