@@ -13,6 +13,8 @@ program
1313 . option ( '-p, --preview' , 'Open preview in the browser.' )
1414 . option ( '-l, --line' , 'Line by Line diff.' )
1515 . option ( '-s, --side' , 'Side by Side diff.' )
16+ . option ( '-w, --word' , 'Word by Word highlight.' )
17+ . option ( '-c, --char' , 'Char by Char highlight.' )
1618 . option ( '-j, --json' , 'Export diff in json format.' ) ;
1719
1820program . on ( '--help' , function ( ) {
@@ -71,11 +73,15 @@ function getInput(program) {
7173function getHtml ( program , input ) {
7274 var diff2Html = require ( 'diff2html' ) . Diff2Html ;
7375
76+ var config = { } ;
77+ config . wordByWord = program . word ;
78+ config . charByChar = program . char ;
79+
7480 if ( program . side ) {
75- return diff2Html . getPrettySideBySideHtmlFromDiff ( input ) ;
81+ return diff2Html . getPrettySideBySideHtmlFromDiff ( input , config ) ;
7682 } else if ( program . json ) {
77- return JSON . stringify ( diff2Html . getJsonFromDiff ( input ) ) ;
83+ return JSON . stringify ( diff2Html . getJsonFromDiff ( input , config ) ) ;
7884 } else {
79- return diff2Html . getPrettyHtmlFromDiff ( input ) ;
85+ return diff2Html . getPrettyHtmlFromDiff ( input , config ) ;
8086 }
8187}
0 commit comments