Hljs small fix

This commit is contained in:
Thomas Miceli 2023-03-18 23:30:37 +01:00
parent b56e02e3ed
commit bd64922554
No known key found for this signature in database
GPG key ID: D86C6F6390AF050F

2
public/main.js vendored
View file

@ -35,8 +35,8 @@ document.addEventListener('DOMContentLoaded', () => {
document.querySelectorAll('.table-code').forEach((el) => { document.querySelectorAll('.table-code').forEach((el) => {
let ext = el.dataset.filename.split('.').pop() let ext = el.dataset.filename.split('.').pop()
if (ext!== 'txt') {
if (hljs.autoDetection(ext) && ext !== 'txt') {
el.querySelectorAll('td.line-code').forEach((ell) => { el.querySelectorAll('td.line-code').forEach((ell) => {
ell.classList.add('language-'+ext) ell.classList.add('language-'+ext)
hljs.highlightElement(ell); hljs.highlightElement(ell);