Last active
May 16, 2017 09:56
-
-
Save subudeepak/9645949 to your computer and use it in GitHub Desktop.
Angular Prettyprint with linenums
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function replaceText(str) | |
{ | |
var str1 = String(str); | |
return str1.replace(/\n/g,"<br/>"); | |
} | |
app.directive('prettyprint', function() { | |
return { | |
restrict: 'C', | |
link: function postLink(scope, element, attrs) { | |
element.html(prettyPrintOne(replaceText(element.html()),'',true)); | |
} | |
}; | |
}); |
Something like
<pre prettyprint>
blah blah
</pre>
should work
Ofcourse, you still need to use Google Prettify.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Nice! Do you have an example of how this will look?