chore(docs): add code prettification

Closes #285
This commit is contained in:
Peter Bacon Darwin
2014-12-06 11:24:55 +00:00
parent 83a6a1cc0b
commit 94b541a3e8
6 changed files with 164 additions and 41 deletions

15
docs/app/js/code.js Normal file
View File

@ -0,0 +1,15 @@
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));
}
};
});