I am in search for a single function to beautify code. I will get source code in a DIV dynamically. How can I format that code.. I don’t want any command line tool. Please someone help me..
I want a function like
hilite($('.codeParent'));
This should replace code with formatted code.. I have googled and found many plugins but I could not find anything that suits to my need.
I think you can use Google prettifier
http://google-code-prettify.googlecode.com/svn/trunk/README.html
UPDATED:
I think you should take a look at https://github.com/einars/js-beautify from http://jsbeautifier.org/(I’ve never used before but I think it’s ok).