✨ Configure highlight.js to suppress HTML warnings and remove redundant configuration
This commit is contained in:
@@ -10,6 +10,11 @@ import json from 'highlight.js/lib/languages/json';
|
|||||||
// Register JSON language
|
// Register JSON language
|
||||||
hljs.registerLanguage('json', json);
|
hljs.registerLanguage('json', json);
|
||||||
|
|
||||||
|
// Configure highlight.js to suppress HTML warnings (our content is safe/internal)
|
||||||
|
hljs.configure({
|
||||||
|
ignoreUnescapedHTML: true
|
||||||
|
});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Apply syntax highlighting to a code element
|
* Apply syntax highlighting to a code element
|
||||||
* @param {HTMLElement} el - The code element to highlight
|
* @param {HTMLElement} el - The code element to highlight
|
||||||
@@ -22,8 +27,6 @@ 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+/, '');
|
||||||
|
|||||||
Reference in New Issue
Block a user