Skip to content

Commit 650fdce

Browse files
silverwindzeripath
authored andcommitted
Fix syntax highlight initialization (#7617) (#7626)
* Fix syntax highlight initialization Previously hljs was initialized via a function that relies on the DOMContentLoaded event, registerd after jQuery's 'ready' event. I assume that with the recent jQuery update, DOMContentLoaded may not be guaranteed to fire after 'ready'. Fixed this via vanilla JS initalization. Fixes: #7559 * semicolon
1 parent 4c69e15 commit 650fdce

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

public/js/index.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -1974,7 +1974,10 @@ $(document).ready(function () {
19741974

19751975
// Highlight JS
19761976
if (typeof hljs != 'undefined') {
1977-
hljs.initHighlightingOnLoad();
1977+
const nodes = [].slice.call(document.querySelectorAll('pre code') || []);
1978+
for (let i = 0; i < nodes.length; i++) {
1979+
hljs.highlightBlock(nodes[i]);
1980+
}
19781981
}
19791982

19801983
// Dropzone

0 commit comments

Comments
 (0)