Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Angular Prettyprint with linenums
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));
}
};
});
@capgunmedia

This comment has been minimized.

Copy link

@capgunmedia capgunmedia commented Nov 21, 2016

Nice! Do you have an example of how this will look?

@subudeepak

This comment has been minimized.

Copy link
Owner Author

@subudeepak subudeepak commented May 16, 2017

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