Skip to content

Commit 14d674a

Browse files
committed
Fix bug 🔧
Uncaught TypeError: Cannot read properties of null (reading 'length')
1 parent 95ed938 commit 14d674a

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

layout.html

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -378,13 +378,12 @@
378378
// https://github.com/highlightjs/highlight.js/blob/main/SUPPORTED_LANGUAGES.md
379379
document.querySelectorAll('code')?.forEach((dom) => {
380380
let lang = dom.className.match(/language\-([^=]*)?(=?)$/);
381-
if (lang.length > 1 && lang[1]) {
381+
if (lang && lang[1]) {
382382
hljs.highlightElement(dom);
383383
}
384-
if (lang.length > 2 && lang[2]) {
384+
if (lang && lang[2]) {
385385
hljs.lineNumbersBlock(dom);
386386
}
387-
console.log(lang);
388387
});
389388
</script>
390389
</body>

0 commit comments

Comments
 (0)