mirror of
https://github.com/oobabooga/text-generation-webui.git
synced 2025-12-06 07:12:10 +01:00
Re-highlight code blocks when switching light/dark themes
This commit is contained in:
parent
7ed1926ce7
commit
e976a5ddc7
|
|
@ -6,4 +6,11 @@ function toggleDarkMode() {
|
||||||
} else {
|
} else {
|
||||||
currentCSS.setAttribute("href", "file/css/highlightjs/github-dark.min.css");
|
currentCSS.setAttribute("href", "file/css/highlightjs/github-dark.min.css");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Re-highlight all code blocks once stylesheet loads
|
||||||
|
currentCSS.onload = function() {
|
||||||
|
document.querySelectorAll("pre code").forEach(block => {
|
||||||
|
hljs.highlightElement(block);
|
||||||
|
});
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue