Detect .c and .h files (#119)

This commit is contained in:
Thomas Miceli 2023-09-28 20:08:57 +02:00 committed by GitHub
parent 2b9eb8e127
commit bae18ecb0a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -21,8 +21,7 @@ document.querySelectorAll('.markdown').forEach((e: HTMLElement) => {
document.querySelectorAll<HTMLElement>('.table-code').forEach((el) => { document.querySelectorAll<HTMLElement>('.table-code').forEach((el) => {
const ext = el.dataset.filename?.split('.').pop() || ''; const ext = el.dataset.filename?.split('.').pop() || '';
if (hljs.getLanguage(ext) && ext !== 'txt') {
if (hljs.autoDetection(ext) && ext !== 'txt') {
el.querySelectorAll<HTMLElement>('td.line-code').forEach((ell) => { el.querySelectorAll<HTMLElement>('td.line-code').forEach((ell) => {
ell.classList.add('language-' + ext); ell.classList.add('language-' + ext);
hljs.highlightElement(ell); hljs.highlightElement(ell);