15 lines
445 B
JavaScript
15 lines
445 B
JavaScript
angular.module('code', [])
|
|
|
|
.directive('code', function() {
|
|
return {
|
|
restrict: 'E',
|
|
terminal: true,
|
|
compile: function(element) {
|
|
var linenums = element.hasClass('linenum');// || element.parent()[0].nodeName === 'PRE';
|
|
var match = /lang-(\S+)/.exec(element[0].className);
|
|
var lang = match && match[1];
|
|
var html = element.html();
|
|
element.html(window.prettyPrintOne(html, lang, linenums));
|
|
}
|
|
};
|
|
}); |