fix markdown formatting
This commit is contained in:
parent
f5e1437f34
commit
e1f641748a
1 changed files with 7 additions and 14 deletions
21
README.md
21
README.md
|
|
@ -303,30 +303,23 @@ index 0000001..0ddf2ba
|
||||||
#### StimulusJS with TypeScript
|
#### StimulusJS with TypeScript
|
||||||
|
|
||||||
```ts
|
```ts
|
||||||
import { Controller } from "@hotwired/stimulus";
|
import { Controller } from '@hotwired/stimulus';
|
||||||
|
|
||||||
import {
|
import { Diff2HtmlUI, Diff2HtmlUIConfig } from 'diff2html/lib/ui/js/diff2html-ui-slim.js';
|
||||||
Diff2HtmlUI,
|
|
||||||
Diff2HtmlUIConfig,
|
|
||||||
} from "diff2html/lib/ui/js/diff2html-ui-slim.js";
|
|
||||||
|
|
||||||
// Requires `yarn add highlight.js`
|
// Requires `yarn add highlight.js`
|
||||||
import "highlight.js/styles/github.css";
|
import 'highlight.js/styles/github.css';
|
||||||
import "diff2html/bundles/css/diff2html.min.css";
|
import 'diff2html/bundles/css/diff2html.min.css';
|
||||||
|
|
||||||
export default class extends Controller {
|
export default class extends Controller {
|
||||||
connect(): void {
|
connect(): void {
|
||||||
const diff2htmlUi = new Diff2HtmlUI(
|
const diff2htmlUi = new Diff2HtmlUI(this.diffElement, this.unifiedDiff, this.diffConfiguration);
|
||||||
this.diffElement,
|
|
||||||
this.unifiedDiff,
|
|
||||||
this.diffConfiguration
|
|
||||||
);
|
|
||||||
|
|
||||||
diff2htmlUi.draw();
|
diff2htmlUi.draw();
|
||||||
}
|
}
|
||||||
|
|
||||||
get unifiedDiff(): string {
|
get unifiedDiff(): string {
|
||||||
return this.data.get("unifiedDiff") || "";
|
return this.data.get('unifiedDiff') || '';
|
||||||
}
|
}
|
||||||
|
|
||||||
get diffElement(): HTMLElement {
|
get diffElement(): HTMLElement {
|
||||||
|
|
@ -336,7 +329,7 @@ export default class extends Controller {
|
||||||
get diffConfiguration(): Diff2HtmlUIConfig {
|
get diffConfiguration(): Diff2HtmlUIConfig {
|
||||||
return {
|
return {
|
||||||
drawFileList: true,
|
drawFileList: true,
|
||||||
matching: "lines",
|
matching: 'lines',
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue