Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

diff2html-cli

Package Overview
Dependencies
Maintainers
1
Versions
96
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

diff2html-cli

Fast Diff to colorized HTML

  • 4.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
23K
increased by31.05%
Maintainers
1
Weekly downloads
 
Created
Source

diff2html-cli

Codacy Quality Badge Codacy Coverage Badge Circle CI Dependency Status

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 scrollenabled, disabledenabled
--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 format[string]
-f--formatOutput formathtml, jsonhtml
-d--diffDiff styleword, charword
-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 diff[string]
-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.


Keywords

FAQs

Package last updated on 25 Aug 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc