5.9.1 • Published 1 year ago

@nullcc/diff2html-cli v5.9.1

Weekly downloads
10
License
MIT
Repository
github
Last release
1 year ago

diff2html-cli

Codacy Quality Badge Codacy Coverage Badge Circle CI

npm David David

node npm npm Gitter

Diff to Html generates pretty HTML diffs from unified and git diff output in your terminal

Features

  • Unified diff and Git diff input

  • line-by-line and side-by-side diff

  • new and old line numbers

  • inserted and removed lines

  • GitHub like style

  • Code syntax highlight

  • Line similarity matching

Online Example

Go to Diff2HTML

Distributions

Setup

npm install -g diff2html-cli

Usage

Usage: diff2html options -- diff args

flagaliasdescriptionchoicesdefault
-s--styleOutput styleline, sideline
--sc--synchronisedScrollSynchronised horizontal scrolltrue, falsetrue
--su--summaryShow files summaryclosed, open, hiddenclosed
--lm--matchingDiff line matching typelines, words, nonenone
--lmt--matchWordsThresholdDiff line matching word threshold0.25
--lmm--matchingMaxComparisonsDiff line matching maximum line comparisons of a block of changes2500
--hwt--htmlWrapperTemplatePath to custom template to be rendered when using the html output formatstring
-f--formatOutput formathtml, jsonhtml
-i--inputDiff input sourcefile, command, stdincommand
-o--outputOutput destinationpreview, stdoutpreview
-u--diffyUpload to diffy.orgbrowser, pbcopy, print
-F--fileSend output to file (overrides output option)string
--ig--ignoreIgnore particular files from the diffstring
-v--versionShow version number
-h--helpShow help

Examples:

diff2html -s line -f html -d word -i command -o preview -- -M HEAD~1

  • diff last commit, line by line, word comparison between lines, previewed in the browser and input from git diff command

diff2html -i file -- my-file-diff.diff

  • reading the input from a file

diff -u file1.txt file2.txt | diff2html -i stdin

  • reading diff from stdin

diff2html -f json -o stdout -- -M HEAD~1

  • print json format to stdout

diff2html -F my-pretty-diff.html -- -M HEAD~1

  • print to file

diff2html -F my-pretty-diff.html --hwt my-custom-template.html -- -M HEAD~1

  • print to file using custom markup templates can include the following variables:
    • <!--diff2html-css--> - writes default CSS to page
    • <!--diff2html-js-ui--> - writes default JavaScript UI scripts to page
    • //diff2html-fileListCloseable - writes code to support selected list interaction, must be within a <script> block
    • //diff2html-synchronisedScroll - writes code to support selected scroll interaction, must be within a <script> block
    • <!--diff2html-diff--> - writes diff content to page

diff2html --ig package-lock.json --ig yarn.lock

  • Ignore package-lock.json and yarn.lock from the generated diff

NOTE: notice the -- in the examples

Contributions

This is a developer friendly project, all the contributions are welcome. To contribute just send a pull request with your changes following the guidelines described in CONTRIBUTING.md. I will try to review them as soon as possible.

Developing

Make some changes and then node src/main.js 😉

License

Copyright 2014-2019 Rodrigo Fernandes. Released under the terms of the MIT license.

Thanks

This project is inspired in pretty-diff by Scott González.


Show Diff Coverage

cat xxx.diff | diff2html -c coverage.json -i stdin -F diff_coverage.html

5.9.1

1 year ago

5.9.0

1 year ago

5.8.1

2 years ago

5.8.0

2 years ago

5.6.4

2 years ago

5.6.3

2 years ago

5.7.1

2 years ago

5.7.0

2 years ago

5.6.2

2 years ago

5.6.1

2 years ago

5.6.0

2 years ago

5.5.1

2 years ago

5.5.0

2 years ago

5.4.5

2 years ago

5.4.3

3 years ago

5.4.2

3 years ago

5.4.1

3 years ago

5.4.0

3 years ago

5.5.2

2 years ago

5.3.0

3 years ago

5.2.12

3 years ago

5.2.11

3 years ago

5.2.10

3 years ago

5.2.9

3 years ago

5.2.8

3 years ago

5.2.4

3 years ago

5.2.7

3 years ago

5.2.6

3 years ago

5.2.5

3 years ago

5.2.3

3 years ago

5.2.2

3 years ago

5.2.1

3 years ago

5.2.0

3 years ago

5.1.9

3 years ago

5.1.8

3 years ago

5.1.7

3 years ago

5.1.5

3 years ago

5.1.4

3 years ago

5.1.3

3 years ago

5.1.2

3 years ago

5.1.1

3 years ago

5.1.0

3 years ago

5.1.6

3 years ago

5.0.6

3 years ago

5.0.5

3 years ago

5.0.4

3 years ago

5.0.7

3 years ago

5.0.3

3 years ago

5.0.2

3 years ago

5.0.1

3 years ago

5.0.0

3 years ago

4.3.2

3 years ago

4.3.1

3 years ago

4.3.0

3 years ago

4.2.0

4 years ago

4.1.4

4 years ago

4.1.3

5 years ago

4.1.2

5 years ago

4.1.1

5 years ago

4.1.0

5 years ago

4.0.0

5 years ago