Configure highlight.js to handle HTML safely with updated settings

This commit is contained in:
2026-01-28 20:23:18 +00:00
parent 9f241da3b0
commit 4079fa0975

View File

@@ -22,6 +22,8 @@ function applyHighlight(el, theme = 'github-dark') {
} }
try { try {
// Configure highlight.js to handle HTML safely
hljs.configure({ useBR: false });
hljs.highlightElement(el); hljs.highlightElement(el);
// Remove any existing theme classes // Remove any existing theme classes
el.className = el.className.replace(/hljs-theme-\w+/, ''); el.className = el.className.replace(/hljs-theme-\w+/, '');