diff --git a/src/ui/js/diff2html-ui-base.ts b/src/ui/js/diff2html-ui-base.ts index 906b97d..5c6bf95 100644 --- a/src/ui/js/diff2html-ui-base.ts +++ b/src/ui/js/diff2html-ui-base.ts @@ -142,7 +142,6 @@ export class Diff2HtmlUI { // HACK: help Typescript know that `this.hljs` is defined since we already checked it if (this.hljs === null) return; const language = file.getAttribute('data-lang'); - const hljsLanguage = language ? this.hljs.getLanguage(language) : undefined; // Collect all the code lines and execute the highlight on them const codeLines = file.querySelectorAll('.d2h-code-line-ctn'); @@ -157,7 +156,7 @@ export class Diff2HtmlUI { const result: HighlightResult = closeTags( this.hljs.highlight(text, { - language: hljsLanguage?.name || 'plaintext', + language: language || 'plaintext', ignoreIllegals: true, }), );