diff2html 3.4.14 → 3.4.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +35 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -300,6 +300,41 @@ index 0000001..0ddf2ba
|
|
|
300
300
|
</html>
|
|
301
301
|
```
|
|
302
302
|
|
|
303
|
+
#### StimulusJS with TypeScript
|
|
304
|
+
|
|
305
|
+
```ts
|
|
306
|
+
import { Controller } from '@hotwired/stimulus';
|
|
307
|
+
|
|
308
|
+
import { Diff2HtmlUI, Diff2HtmlUIConfig } from 'diff2html/lib/ui/js/diff2html-ui-slim.js';
|
|
309
|
+
|
|
310
|
+
// Requires `yarn add highlight.js`
|
|
311
|
+
import 'highlight.js/styles/github.css';
|
|
312
|
+
import 'diff2html/bundles/css/diff2html.min.css';
|
|
313
|
+
|
|
314
|
+
export default class extends Controller {
|
|
315
|
+
connect(): void {
|
|
316
|
+
const diff2htmlUi = new Diff2HtmlUI(this.diffElement, this.unifiedDiff, this.diffConfiguration);
|
|
317
|
+
|
|
318
|
+
diff2htmlUi.draw();
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
get unifiedDiff(): string {
|
|
322
|
+
return this.data.get('unifiedDiff') || '';
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
get diffElement(): HTMLElement {
|
|
326
|
+
return this.element as HTMLElement;
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
get diffConfiguration(): Diff2HtmlUIConfig {
|
|
330
|
+
return {
|
|
331
|
+
drawFileList: true,
|
|
332
|
+
matching: 'lines',
|
|
333
|
+
};
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
```
|
|
337
|
+
|
|
303
338
|
## Diff2Html Usage
|
|
304
339
|
|
|
305
340
|
### Diff2Html API
|