# diff2html-cli **Repository Path**: mirrors_rtfpessoa/diff2html-cli ## Basic Information - **Project Name**: diff2html-cli - **Description**: Pretty diff to html javascript cli (diff2html-cli) - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2020-08-18 - **Last Updated**: 2026-04-04 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # diff2html-cli [](https://www.npmjs.com/package/diff2html-cli) [](https://www.npmjs.com/package/diff2html-cli) [](https://www.npmjs.com/package/diff2html-cli) [](https://github.com/rtfpessoa/diff2html-cli/actions/workflows/release.yml) [](https://www.npmjs.com/package/diff2html-cli) [](https://www.npmjs.com/package/diff2html-cli) [](https://www.npmjs.com/package/diff2html-cli) [](https://www.npmjs.com/package/diff2html-cli) Diff to Html generates pretty HTML diffs from unified and git diff output in your terminal ## Table of Contents - [Features](#features) - [Online Example](#online-example) - [Distributions](#distributions) - [Setup](#setup) - [Usage](#usage) - [Exit Status Codes](#exit-status-codes) - [Custom HTML wrapper template](#custom-html-wrapper-template) - [Examples](#examples) - [Contribute](#contribute) - [Developing](#developing) - [License](#license) - [Thanks](#thanks) ## 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](https://diff2html.xyz/) ## Distributions - [NPM CLI](https://www.npmjs.org/package/diff2html-cli) - [NPM / Node.js library [ES5 & ES6]](https://github.com/rtfpessoa/diff2html) - [CDNJS](https://cdnjs.com/libraries/diff2html) - [WebJar](http://www.webjars.org/) ## Setup ```sh npm install -g diff2html-cli ``` ## Usage Usage: diff2html [ flags and/or options ] -- [git diff passthrough flags and options] | flag | alias | description | choices | default | | ----- | --------------------------------- | -------------------------------------------------------------------------------------------------- | ---------------------------- | --------- | | -s | --style | Output style | `line`, `side` | `line` | | --fct | --fileContentToggle | Adds a viewed checkbox to toggle file content | `true`, `false` | `true` | | --sc | --synchronisedScroll | Synchronised horizontal scroll | `true`, `false` | `true` | | --hc | --highlightCode | Highlight code | `true`, `false` | `true` | | --cs | --colorScheme | Color scheme | `auto`, `dark`, `light` | `auto` | | --su | --summary | Show files summary | `closed`, `open`, `hidden` | `closed` | | -d | --diffStyle | Diff style | `word`, `char` | `word` | | --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` | | | --diffMaxChanges | Number of changed lines after which a file diff is deemed as too big and not displayed | | | | | --diffMaxLineLength | Number of characters in a diff line after which a file diff is deemed as too big and not displayed | | | | | --renderNothingWhenEmpty | Render nothing if the diff shows no change in its comparison | | `false` | | | --maxLineSizeInBlockForComparison | Maximum number of characters of the bigger line in a block to apply comparison | | `200` | | | --maxLineLengthHighlight | Maximum number of characters in a line to apply highlight | | `10000` | | --hwt | --htmlWrapperTemplate | Path to custom template to be rendered when using the `html` output format | `[string]` | | -t | --title | Page title for `html` output | `[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 | | | ### Exit Status Codes - :tada: 0: Success - :dizzy_face: 1: Generic Error - :cold_sweat: 3: Input diff is empty - :cop: 4: Value of `--hwt | --htmlWrapperTemplate` is not a valid file ### Custom HTML wrapper template The template is a very based on a simple replace of several placeholders as coded https://github.com/rtfpessoa/diff2html-cli/blob/master/src/cli.ts#L40 To provide a custom template you need to make sure you have the following comments and imports in your HTML, exactly as they are here: - Inside the `
` tag ```html ``` - Inside the `` tag ```html