diff --git a/internal/web/html.go b/internal/web/html.go index 0497a13..921e6f7 100644 --- a/internal/web/html.go +++ b/internal/web/html.go @@ -454,7 +454,9 @@ const indexHTML = ` const content = currentAssistantDiv.querySelector('.message-content'); content.innerHTML = renderMarkdown(currentContent); if (typeof hljs !== 'undefined') { - hljs.highlightAll(); + content.querySelectorAll('pre code').forEach(function(block) { + hljs.highlightElement(block); + }); } chatBox.scrollTop = chatBox.scrollHeight; } @@ -499,7 +501,9 @@ const indexHTML = ` chatBox.scrollTop = chatBox.scrollHeight; if (role !== 'user' && typeof hljs !== 'undefined') { - hljs.highlightAll(); + text.querySelectorAll('pre code').forEach(function(block) { + hljs.highlightElement(block); + }); } return div;