diff2html
Advanced tools
Comparing version 2.9.0 to 2.10.0
{ | ||
"name": "diff2html", | ||
"version": "2.9.0", | ||
"version": "2.10.0", | ||
"homepage": "https://diff2html.xyz", | ||
@@ -63,3 +63,3 @@ "description": "Fast Diff to colorized HTML", | ||
"devDependencies": { | ||
"autoprefixer": "^9.5.1", | ||
"autoprefixer": "^9.6.0", | ||
"browserify": "^16.2.3", | ||
@@ -77,3 +77,3 @@ "clean-css-cli": "^4.3.0", | ||
"postcss-cli": "^6.1.2", | ||
"uglify-js": "^3.5.9" | ||
"uglify-js": "^3.6.0" | ||
}, | ||
@@ -80,0 +80,0 @@ "license": "MIT", |
@@ -57,2 +57,13 @@ # diff2html | ||
To load correctly in the Browser you always need to include the stylesheet in the final HTML. | ||
Import the stylesheet | ||
```html | ||
<!-- CSS --> | ||
<link rel="stylesheet" type="text/css" href="dist/diff2html.css"> | ||
``` | ||
You can also refer to it from a CDN like [CDNJS](https://cdnjs.com/libraries/diff2html). | ||
### Browser Library | ||
@@ -189,2 +200,3 @@ | ||
- `matchingMaxComparisons`: perform at most this much comparisons for line matching a block of changes, default is `2500` | ||
- `maxLineSizeInBlockForComparison`: maximum number os characters of the bigger line in a block to apply comparison, default is `200` | ||
- `maxLineLengthHighlight`: only perform diff changes highlight if lines are smaller than this, default is `10000` | ||
@@ -191,0 +203,0 @@ - `templates`: object with previously compiled templates to replace parts of the html |
@@ -22,2 +22,3 @@ /* | ||
matchingMaxComparisons: 2500, | ||
maxLineSizeInBlockForComparison: 200, | ||
maxLineLengthHighlight: 10000, | ||
@@ -24,0 +25,0 @@ renderNothingWhenEmpty: false |
@@ -97,6 +97,14 @@ /* | ||
var comparisons = oldLines.length * newLines.length; | ||
var maxComparisons = that.config.matchingMaxComparisons || 2500; | ||
var doMatching = comparisons < maxComparisons && (that.config.matching === 'lines' || | ||
that.config.matching === 'words'); | ||
var maxLineSizeInBlock = Math.max.apply(null, | ||
[0].concat((oldLines.concat(newLines)).map( | ||
function(elem) { | ||
return elem.content.length; | ||
} | ||
))); | ||
var doMatching = comparisons < that.config.matchingMaxComparisons && | ||
maxLineSizeInBlock < that.config.maxLineSizeInBlockForComparison && | ||
(that.config.matching === 'lines' || that.config.matching === 'words'); | ||
if (doMatching) { | ||
@@ -103,0 +111,0 @@ matches = matcher(oldLines, newLines); |
@@ -99,6 +99,11 @@ /* | ||
var comparisons = oldLines.length * newLines.length; | ||
var maxComparisons = that.config.matchingMaxComparisons || 2500; | ||
var doMatching = comparisons < maxComparisons && (that.config.matching === 'lines' || | ||
that.config.matching === 'words'); | ||
var maxLineSizeInBlock = Math.max.apply(null, (oldLines.concat(newLines)).map(function(elem) { | ||
return elem.length; | ||
})); | ||
var doMatching = comparisons < that.config.matchingMaxComparisons && | ||
maxLineSizeInBlock < that.config.maxLineSizeInBlockForComparison && | ||
(that.config.matching === 'lines' || that.config.matching === 'words'); | ||
if (doMatching) { | ||
@@ -105,0 +110,0 @@ matches = matcher(oldLines, newLines); |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
387619
6661
322