I'm currently looking for a Syntax Highlighter (
http://alexgorbatchev.com/SyntaxHighlighter/) that would enable me to format
Java source code while presenting it in the UI. But I doubt if the Syntax Highlighter that I mentioned would do this.
I have some source code stored in the database which could be in a single line like this:
I want a library or a tool that would format this. I in fact wrote a small logic that would do it for me. I guess I covered most of the cases, be it however complex or how many ever loops it has, it formats and prints the formatted code perfectly. But now I would need this to work for other programming languages as well (read Scala, Ruby etc). I'm now looking for a strategy that would help me to achieve this with little effort. Should I consider storing the formatting information along with the source code in the database like this?
Or should I use some CSS to get the formatting right? How is it done here at the ranch? When I use the code tags, is it formatted?