Minor optimization after e976a5ddc7

This commit is contained in:
oobabooga 2025-06-09 18:40:54 -07:00
parent 263b5d5557
commit d085dc6a93

View file

@ -9,8 +9,12 @@ function toggleDarkMode() {
// Re-highlight all code blocks once stylesheet loads
currentCSS.onload = function() {
document.querySelectorAll("pre code").forEach(block => {
hljs.highlightElement(block);
const messageBodies = document.getElementById("chat").querySelectorAll(".message-body");
messageBodies.forEach((messageBody) => {
const codeBlocks = messageBody.querySelectorAll("pre code");
codeBlocks.forEach((codeBlock) => {
hljs.highlightElement(codeBlock);
});
});
};
}