npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@nullcc/diff2html-cli

v5.9.1

Published

Fast Diff to colorized HTML

Downloads

685

Readme

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]

| flag | alias | description | choices | default | | --- | --- | --- | --- | --- | | -s | --style | Output style | line, side | line | | --sc | --synchronisedScroll | Synchronised horizontal scroll | true, false | true | | --su | --summary | Show files summary | closed, open, hidden | closed | | --lm | --matching | Diff line matching type | lines, words, none | none | | --lmt | --matchWordsThreshold | Diff line matching word threshold | | 0.25 | | --lmm | --matchingMaxComparisons | Diff line matching maximum line comparisons of a block of changes | 2500 | | --hwt | --htmlWrapperTemplate | Path to custom template to be rendered when using the html output format | [string] | | -f | --format | Output format | html, json | html | | -i | --input | Diff input source | file, command, stdin | command | | -o | --output | Output destination | preview, stdout | preview | | -u | --diffy | Upload to diffy.org | browser, pbcopy, print | | | -F | --file | Send output to file (overrides output option) | [string] | | | --ig | --ignore | Ignore particular files from the diff | [string] | | | -v | --version | Show version number | | | | -h | --help | Show 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