{ hljs.initHighlighting(); $('pre').each(function(){ var $language = this.className.match(/language-(\w+)/) if($language && $language[1]){ $(this).attr('data-title', $language[1]) } }) $('pre[class*=language-javascript] code').each(function(i,e) { var lines = $(this).text().split('\n').length - 1; var $numbering = $('').addClass('pre-numbering'); $(this) .addClass('has-numbering') .parent() .append($numbering); for (i = 1; i <= lines; i++) { $numbering.append($('').text(i)); } }); });