GitHub-like HTML diff Tool-diff2html. js
| Autor: | rtfpessoa |
|---|---|
| Views Total: | 6,600 |
| Sitio oficial: | Ir a la web |
| Actualizado: | February 8, 2019 |
| Licencia: | MIT |
Vista prévia
Descripción
diff2html. js es una pequeña biblioteca de JavaScript que se utiliza para crear una herramienta de diff HTML estilo GitHub con resaltado de sintaxis para git diff output.
Instalación
# Yarn $ yarn add diff2html # NPM $ npm install diff2html --save
Funcionamiento
Incluya el diff2html. js y otros recursos necesarios en la Página Web.
<!-- diff2html files --> <link rel="stylesheet" href="dist/diff2html.min.css"> <script src="dist/diff2html.min.js"></script> <!-- highlight.js --> <link rel="stylesheet" href="/path/to/github.min.css"> <script src="/path/to/highlight.min.js"></script> <script src="/path/to/scala.min.js"></script>
Uso básico.
// Pretty HTML diff Diff2Html.getPrettyHtml(exInput, configuration) // Intermediate Json From Git Word Diff Output Diff2Html.getJsonFromDiff(exInput)
Configuraciones disponibles.
Diff2Html.getPrettyHtml(exInput, {
// the format of the input data: 'diff' or 'json', default is 'diff'
inputFormat: 'diff',
// the format of the output data: 'line-by-line' or 'side-by-side'
outputFormat: 'line-by-line',
// show a file list before the diff: true or false,
showFiles: false,
// 'lines' for matching lines, 'words' for matching lines and words
matching: 'none',
// similarity threshold for word matching, default is
matchWordsThreshold: .25
// perform at most this much comparisons for line matching a block of changes
matchingMaxComparisons: 2500,
// only perform diff changes highlight if lines are smaller than this
maxLineLengthHighlight: 10000,
// object with previously compiled templates to replace parts of the html
templates: {}
/ /object with raw not compiled templates to replace parts of the html
rawTemplates: {}
}) Registro de cambios
v2.7.0 (02/08/2019)
- actualizar





