Best Web Design

Time-Savers: Code Beautifier And Formatter

Posted by: rohitdubal on: February 16, 2009

Well-documented and readable source code is essential for every collaborative project. Logically structured, well organized and nicely formatted, the code can speed up the bug hunting and help to keep the code clean, minimal and still functional. These aspects are particularly important if the code is being developed by a group of developers: in this context a common scheme for source code presentation is necessary. You don’t have to do everything by hand; in fact, there are many tools which can save a lot of time – for you and your co-workers.

The tools and services we’ve collected below aren’t validators. They format and beautify the code; some of them can remove redundant elements. Using them, you have to make sure you have a backup, so your data can always be restored.

Let’s take a look at code beautifier and formatter which can save you a lot of time and help to maintain a clean and readable source code.

Code Beautifier And Formatter

1. Quick Highlighter
Quick Highlighter can format source codes written in over 85 languages – among them C++, PHP, Ruby, HTML, JavaScript, Perl, Python, Smarty, XML and more. The tool formats source code and highlights inbuilt keywords, data types etc.

Screenshot


2. PrettyPrinter
Knows PHP, Java, C++, C, Perl, JavaScript, CSS. The service offers many formatting options you can use to present the code just the way you’d like it to look like.

Screenshot

3. PHP Code Beautifier
This tool is designed to beautify PHP code, applying most of the PEAR standard requirements to it. It can even process really scrambled scripts, e.g. all code in one line, and thus may help you to get scripts into a more readable form. It sets missing line breaks without removing any additional line breaks that you may use to group related things and corrects wrong indentation according to the level of nested braces.

4. Ruby Script Beautifier
Ruby Beautifier accepts a command-line list of file names, creates a backup copy of each named file and beautifies the originals. If there is an indentation error (an imbalance of opening and closing keywords), the script will print an error message but will save the result anyway.

5. Tabifier
The tabifier is a tool to properly indent computer code. The style it produces is a mix of my personal preferences for indentation plus what I could manage to make a program produce from dirty source. The tabifier currently supports CSS, HTML, and C Style code; the latter being anything that uses curly braces to start and end blocks, and semicolons to terminate statements.

Screenshot

6. CSS Beautifier
This tool offers a variety of options, among them – Alphabetizing Feature and De-Capitalization Feature.

Screenshot

7. CSS Formatierer und Optimierer
Has different compression layouts; you can sort selectors, properties, regroup selectors, optimize shorthands, compress colors, compress font-weight, discard invalid properties and add timestamps. You can also create a custom template the system will use to format the code. The result can be outputted as a file. A copy / mirror of the tool can be found on cleancss.com.

Screenshot

8. Highlight.js
Highlight.js highlights syntax in code examples on blogs, forums and in fact on any web pages. It’s very easy to use because it works automatically: finds blocks of code, detects a language, highlights it. Also available as WordPress-Plugin and Firefox-extension. Suported languages: Python, Ruby, Perl, PHP, HTML, CSS, Django, JavaScript, VBScript, Delphi, Java, C++, SQL. Similar tools is offered by Google: Googles Javascript Code Prettifier.

Screenshot
Screenshot

9. Code Beautifier Plus
Beautifies Java, C# and ActionScript.

Screenshot

10. PHP Formatter
PHP formatter adds comments after control structures, colors the output, links to the php-manual by inline-functions, removes comments and removes empty lines. There are 5 pre-defined layouts, but you can also define your own styles.

Screenshot

11. PHP_Beautifier
A tool to beautify PHP 4 and PHP 5 source code – to run on your own server. Requires PHP 5.

12. Online Beautifier for JavaScript
The tool completely reformats the JavaScript source code, so that it becomes a little bit more readable.

13. Lorins simple code beautifier for C++, C#, Java, and Javascript
You can use the source code of this beautifier to creat your own code formatters.

14. Tidy
A classic. Tidy consists of many program libraries and comes and has many variations. E.g. you can use

Screenshot

Commercial Solutions

15. SourceFormatX Source Code Formatter & Beautifier
For developers. The tool supports neither HTML nor CSS; instead Javascript, VB, PHP, ASP, JSP, HTC, C, JAVA and more. Price: $36,99, Windows.

Screenshot

16. Polystyle
Polystyle automatically reformats source code in your personal style. Polystyle learns your formatting style by examining examples of your code. It is another Windows-tool which supports Actionscript, ASP, C/C++, C#, CMAC, CSS, HTML, Java, Javascript, JSP, PHP, Pascal/Delphi, Perl, Python and Visual Basic. Price: 79$, can be used from the shell and Windows Explorer

Leave a Reply


  • KWAME: Your work is superb!
  • ishan banga: Nice share.. ------------------------------------------------------------------------------------ I m a webdesigner view
  • ishan banga: nice one for sure... 49 Free Ultimate

 

February 2009
M T W T F S S
« Nov   Mar »
 1
2345678
9101112131415
16171819202122
232425262728  

Flickr Photos

Nubes de lluvia - Rain clouds - Explore ! (Front Page)

Sligachan II

More Photos

Follow me on Twitter

Error: Twitter did not respond. Please wait a few minutes and refresh this page.

More on rohitdubal.wordpress.com

RSS Suscribe Me

  • PageOnce Auto Invitations For Hongkiat.com Readers June 2, 2009
    Aimen (VP of PageOnce) drop me an email today, I guess he felt sorry that I’m actually doing invitations manually, lol. For those of you guys who are still interested in getting a private invitation to tryout PageOnce instead of waiting for the official launch, you can now ‘self-invite‘ or register an account [...]
    rohitdubal
  • SendAlong – Send Large Email Attachments Over Internet June 2, 2009
    Over the pass few years, we’ve seen rapid increase in terms of storage space from few of the free email providers like Gmail, Yahoo! Mail, Hotmail (Windows Live Mail), etc but rarely these guys increase the file attachment capacity. Most free email services limit you to send a maximum of 10Mb attachment per email. SendAlong is [...]
    rohitdubal
  • Viwawa – Play Multiplayers Mahjong, Big5 (and more) Online June 2, 2009
    Here’s what got me stuck in front of the monitor for the pass 3 hours – Viwawa. Weird name but cool site with fun multiplayer games like Stwack, Match It, Checkmate, Sushido and my all time favourite chinese gambling games mahjong and big 5. The most interesting part is all these games are multi players. [...]
    rohitdubal
  • Turn Yourself Into Superstar With FaceInHole June 2, 2009
    If you think putting your head up famous magazines like Time, Forbes, GQ, etc is fun, wait till you try this. Faceinhole says forget about the magazine covers, let’s make you a celebrity. Turn yourself into Fabio Cannavaro holding the world cup trophy, superman, Austin Powers, G.Bush, Osama Bin Laden, etc with the [...]
    rohitdubal