Case insensitive language highlighting matching

This automatically lowercases language names used in code blocks when finding highlighting scripts for them, since highlightJS defines all languages with lowercase names.
This commit is contained in:
x4e 2021-01-24 01:24:12 +00:00 committed by GitHub
parent 53ea85dc86
commit 795748457c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -68,7 +68,7 @@
var jss = [hlbaseUri + "highlight.min.js"]; var jss = [hlbaseUri + "highlight.min.js"];
// Check what we need to load // Check what we need to load
for (i=0; i < lb.length; i++) { for (i=0; i < lb.length; i++) {
lang = lb[i].className.replace('language-',''); lang = lb[i].className.replace('language-','').toLowerCase();
// Support the aliases specified above // Support the aliases specified above
if (aliasmap[lang]) lang = aliasmap[lang]; if (aliasmap[lang]) lang = aliasmap[lang];
lurl = hlbaseUri + "highlightjs/" + lang + ".min.js"; lurl = hlbaseUri + "highlightjs/" + lang + ".min.js";