fix: wrong lang badge of code block
This commit is contained in:
parent
83eac8261e
commit
306203221a
1 changed files with 4 additions and 6 deletions
|
@ -67,16 +67,14 @@ document.addEventListener('DOMContentLoaded', function(event) {
|
|||
break;
|
||||
}
|
||||
}
|
||||
if (lang) {
|
||||
block.setAttribute('class', 'hljs ' + lang);
|
||||
} else {
|
||||
lang = block
|
||||
.getAttribute('class')
|
||||
.replace('hljs ', '');
|
||||
if (!lang) {
|
||||
cls = block.getAttribute('class');
|
||||
lang = cls ? cls.replace('hljs ', '') : '';
|
||||
}
|
||||
if (lang.startsWith('language-')) {
|
||||
lang = lang.substr(9);
|
||||
}
|
||||
block.setAttribute('class', 'hljs ' + lang);
|
||||
block.parentNode.setAttribute('data-lang', lang);
|
||||
hljs.highlightBlock(block);
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue