From 1d01d73e748dbb74cc5c9855e8528b94c514579c Mon Sep 17 00:00:00 2001 From: Rodrigo Fernandes Date: Sun, 24 Jun 2018 14:38:54 +0100 Subject: [PATCH] Add a browser example of usage Thanks to @dxz6228 for the feedback --- README.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/README.md b/README.md index c389089..9d4dacd 100644 --- a/README.md +++ b/README.md @@ -68,6 +68,14 @@ Import the stylesheet and the library code It will now be available as a global variable named `Diff2Html`. +```js +var diffHtml = Diff2Html.getPrettyHtml( + '', + {inputFormat: 'diff', showFiles: true, matching: 'lines', outputFormat: 'side-by-side'} +); +document.getElementById("destination-elem-id").innerHTML = diffHtml; +``` + ### Node Module ```js