-
Notifications
You must be signed in to change notification settings - Fork 11.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: George Araújo <[email protected]>
- Loading branch information
1 parent
da9ccdb
commit b1797ed
Showing
6 changed files
with
535 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
{% if page.code_diff %} | ||
<!-- diff2html doesn't go well with Bootstrap Table --> | ||
<script | ||
src="https://cdn.jsdelivr.net/npm/[email protected]/bundles/js/diff2html-ui.min.js" | ||
integrity="sha256-eU2TVHX633T1o/bTQp6iIJByYJEtZThhF9bKz/DcbbY=" | ||
crossorigin="anonymous" | ||
></script> | ||
<script> | ||
let theme = localStorage.getItem('theme'); | ||
/* Create echarts chart as another node and hide the code block, appending the echarts node after it | ||
this is done to enable retrieving the code again when changing theme between light/dark */ | ||
document.querySelectorAll('pre>code.language-diff2html').forEach((elem) => { | ||
const textData = elem.textContent; | ||
const backup = elem.parentElement; | ||
backup.classList.add('unloaded'); | ||
/* create diff node */ | ||
let diffElement = document.createElement('div'); | ||
diffElement.classList.add('diff2html'); | ||
backup.after(diffElement); | ||
const configuration = { colorScheme: theme, drawFileList: true, highlight: true, matching: 'lines' }; | ||
const diff2htmlUi = new Diff2HtmlUI(diffElement, textData, configuration); | ||
diff2htmlUi.draw(); | ||
}); | ||
</script> | ||
{% endif %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.