Gathering detailed insights and metrics for diff2html-cli
Gathering detailed insights and metrics for diff2html-cli
Gathering detailed insights and metrics for diff2html-cli
Gathering detailed insights and metrics for diff2html-cli
npm install diff2html-cli
Add file viewed checkbox option to cli
Published on 03 Jun 2022
Fix title cli option
Published on 03 Jun 2022
Add missing diff2html configurations to cli
Published on 18 Jan 2022
Bump dependencies
Published on 24 Jul 2020
Fix ignore option
Published on 09 May 2020
Bump diff2html library dependency
Published on 05 Feb 2020
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
537 Stars
362 Commits
50 Forks
9 Watching
8 Branches
12 Contributors
Updated on 25 Nov 2024
TypeScript (91.54%)
JavaScript (5.81%)
HTML (2.47%)
Shell (0.18%)
Cumulative downloads
Total Downloads
Last day
44.9%
4,797
Compared to previous day
Last week
6.9%
20,467
Compared to previous week
Last month
0.9%
89,472
Compared to previous month
Last year
185.9%
736,319
Compared to previous year
5
31
Diff to Html generates pretty HTML diffs from unified and git diff output in your terminal
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
Go to Diff2HTML
1npm install -g diff2html-cli
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 |
--hwt | --htmlWrapperTemplate
is not a valid fileThe 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:
<head>
tag1<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.9.0/styles/github.min.css" /> 2<!--diff2html-css--> 3<!--diff2html-js-ui--> 4<script> 5 document.addEventListener('DOMContentLoaded', () => { 6 const targetElement = document.getElementById('diff'); 7 const diff2htmlUi = new Diff2HtmlUI(targetElement); 8 //diff2html-fileListToggle 9 //diff2html-synchronisedScroll 10 //diff2html-highlightCode 11 }); 12</script>
<body>
tag1<div id="diff"> 2 <!--diff2html-diff--> 3</div>
diff2html -s line -f html -d word -i command -o preview -- -M HEAD~1
diff2html -i file -- my-file-diff.diff
diff -u file1.txt file2.txt | diff2html -i stdin
diff2html -f json -o stdout -- -M HEAD~1
diff2html -F my-pretty-diff.html -- -M HEAD~1
diff2html -F my-pretty-diff.html --hwt my-custom-template.html -- -M HEAD~1
diff2html --ig package-lock.json --ig yarn.lock
package-lock.json
and yarn.lock
from the generated diffNOTE: notice the --
in the examples
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.
Make some changes, yarn build
and then ./bin/diff2html
😉
Copyright 2014-present Rodrigo Fernandes. Released under the terms of the MIT license.
This project is inspired in pretty-diff by Scott González.
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
5 existing vulnerabilities detected
Details
Reason
security policy file detected
Details
Reason
Found 1/9 approved changesets -- score normalized to 1
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2024-11-18
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More