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 hidden or 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)); | |
| } | |
| }; | |
| }); |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Something like
should work
Ofcourse, you still need to use Google Prettify.