Skip to content

Commit

Permalink
Fix bug with highlighting code
Browse files Browse the repository at this point in the history
  • Loading branch information
bterlson committed Aug 19, 2015
1 parent 323a97e commit 27bd1fc
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/Spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,11 @@ module.exports = class Spec {
this._log('Highlighting syntax...');
const codes = this.doc.querySelectorAll('pre code');
for (let i = 0; i < codes.length; i++) {
hljs.highlightBlock(codes[i]);
const classAttr = codes[i].getAttribute('class');
const lang = classAttr.replace(/lang(uage)?\-/, '');
const result = hljs.highlight(lang, codes[i].textContent);
codes[i].innerHTML = result.value;
codes[i].setAttribute('class', classAttr + ' hljs');
}
}

Expand Down

0 comments on commit 27bd1fc

Please sign in to comment.