Online code beautifier and formatter

Code Formatting

Code Formatting Problem Overview


What are the best online code beautifier and formatter out there? I'm not asking for highlighters. Any language will do.

Code Formatting Solutions


Solution 1 - Code Formatting

Solution 2 - Code Formatting

For PHP, Java, C++, C, Perl, JavaScript, CSS you can try:

http://www.prettyprinter.de/index.php

Solution 3 - Code Formatting

You can use Perl::Tidy for Perl.

Solution 4 - Code Formatting

JsonLint is good for validating and formatting JSON.

Solution 5 - Code Formatting

What language?? There are different tools for almost every imaginable programming language, since they all have different syntactic rules and conventions.

Good ol' http://www.gnu.org/software/indent/">`indent`</a> is a nice, customizable, command-line utility to format C and C++ programs.

Solution 6 - Code Formatting

It depends of the language, and of the architecture you are using.

alt text alt text

For example, in a php platform, you can format almost language with GeSHi

As bluish comments, GeSHi is a generic syntax highlighter, with no beautification feature. It is more used on the server side, and combine it with a beautification tool can be tricky, as illustrated with this GeSHi drupal ticket.

Solution 7 - Code Formatting

I've used Quick Highlighter a lot. Works great for a huge list of languages.

Solution 8 - Code Formatting

Use gist.github.com. There is a multi-language support(java, c, c++, c#, vb, haskell, ruby, javascript, lua, HTML, SQL, Tcl, Perl, JSON, groovy...)

Here is a sample "Generate LiquiBase changeLogs using Groovy"

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionTim BolandView Question on Stackoverflow
Solution 1 - Code FormattingJamesM-SiteGenView Answer on Stackoverflow
Solution 2 - Code FormattingQAZView Answer on Stackoverflow
Solution 3 - Code Formattingbrian d foyView Answer on Stackoverflow
Solution 4 - Code FormattingjohnstokView Answer on Stackoverflow
Solution 5 - Code FormattingDan LenskiView Answer on Stackoverflow
Solution 6 - Code FormattingVonCView Answer on Stackoverflow
Solution 7 - Code FormattingAdamCView Answer on Stackoverflow
Solution 8 - Code FormattingrayyildizView Answer on Stackoverflow