Fix - Demo doesn't work when code highlight fails
Browse files- demo/scripts/demo.js +8 -4
demo/scripts/demo.js
CHANGED
@@ -128,10 +128,14 @@ document.addEventListener('DOMContentLoaded', function () {
|
|
128 |
});
|
129 |
|
130 |
|
131 |
-
|
132 |
-
.
|
133 |
-
|
134 |
-
|
|
|
|
|
|
|
|
|
135 |
|
136 |
|
137 |
/////////////////////////////////////////////
|
|
|
128 |
});
|
129 |
|
130 |
|
131 |
+
try {
|
132 |
+
document.querySelectorAll('pre code')
|
133 |
+
.forEach((element) => {
|
134 |
+
hljs.highlightBlock(element);
|
135 |
+
});
|
136 |
+
} catch (e) {
|
137 |
+
// Silently ignore the highlight errors
|
138 |
+
}
|
139 |
|
140 |
|
141 |
/////////////////////////////////////////////
|