Skip to content

jung-hunsoo/exdiff

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Exdiff

Hex.pm

Text difference library for Elixir

Installation

Add exdiff to your mix.exs dependencies:

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

Quick example

> Exdiff.diff("abd", "abcd")
%{html: "<div class='exdiff-eq'>ab</div><div class='exdiff-ins'>c</div><div class='exdiff-eq'>d</div>", length: 1}

> Exdiff.diff("abd", "abcd", wrapper_tag: "span")
%{html: "<span class='exdiff-eq'>ab</span><span class='exdiff-ins'>c</span><span class='exdiff-eq'>d</span>", length: 1}

> Exdiff.diff_to_html("abd", "abcd")
{1, "<div class='exdiff-eq'>ab</div><div class='exdiff-ins'>c</div><div class='exdiff-eq'>d</div>"}

> Exdiff.diff_to_html("abd", "abcd", wrapper_tag: "span")
{1, "<span class='exdiff-eq'>ab</span><span class='exdiff-ins'>c</span><span class='exdiff-eq'>d</span>"}

Usage

There are three HTML classes wrapped with tag.

  • exdiff-del
  • exdiff-ins
  • exdiff-eq

Test

mix test

About

Text difference library for Elixir

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages