Monday, 30 May 2016

Produce html diff with diff2html-cli

It is handy to do with one nice JavaScript tool, which works on any platform:
https://www.npmjs.com/package/diff2html-cli

> npm install diff2html-cli
> diff -u fileA.txt fileB.txt | diff2html -F diff.html -i stdin


It is important to have -u option for diff command you pipe into diff2html, because it produces unified diff and diff2html expects unified diff.

It is also possible to do these two commands separatedly, without piping:

Write diff of a and b into a-b.diff file:
> diff -u a.txt b.txt > a-b.diff

Produce HTML file from the diff file:
> diff2html -F a-b.html -i file -- a-b.diff

4 comments:

  1. Simply a smiling visitor here to share the love (:, btw outstanding design . "Audacity, more audacity and always audacity." by Georges Jacques Danton. webflow experts

    ReplyDelete
  2. I have been exploring for a little for any high quality articles or blog posts in this kind of area . Exploring in Yahoo I ultimately stumbled upon this web site. Reading this information So i¡¦m glad to show that I have an incredibly good uncanny feeling I came upon exactly what I needed. I such a lot indubitably will make certain to don¡¦t forget this web site and give it a look a relentless basis. webflow design agency

    ReplyDelete
  3. I don’t even know how I ended up here, but I thought this post was good. I do not know who you are but certainly you are going to a famous blogger if you aren’t already Cheers! user experience design

    ReplyDelete
  4. I absolutely love your blog and find a lot of your post’s to be exactly I’m looking for. can you offer guest writers to write content to suit your needs? I wouldn’t mind writing a post or elaborating on a few of the subjects you write in relation to here. Again, awesome weblog! top web development companies

    ReplyDelete