- July 12th, 2007
- 68 Comments
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 Highlighter1
3. PHP Code Beautifier5
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 Beautifier6
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.
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.
7. CSS Formatierer und Optimierer11
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.com12.
10. PHP Formatter20
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.
You can use the source code of this beautifier to creat your own code formatters.
- TidyGUI26 to format the code right on your desktop,
- HTML Tidy27
- Clean up your Web pages with HTML TIDY28
- HTML Code Export29 (software based upon Tidy)
- HTML Validator Firefox Extension32
- 1 http://quickhighlighter.com/
- 2 http://quickhighlighter.com/
- 3 http://www.prettyprinter.de/
- 4 http://www.prettyprinter.de/
- 5 http://www.tote-taste.de/X-Project/beautify/
- 6 http://www.arachnoid.com/ruby/rubyBeautifier.html
- 7 http://tools.arantius.com/tabifier
- 8 http://tools.arantius.com/tabifier
- 9 http://www.lonniebest.com/FormatCSS/
- 10 http://www.lonniebest.com/FormatCSS/
- 11 http://cdburnerxp.se/cssparse/css_optimiser.php?lang=de
- 12 http://www.cleancss.com/?lang=de
- 13 http://cdburnerxp.se/cssparse/css_optimiser.php?lang=de
- 14 http://softwaremaniacs.org/soft/highlight/en/
- 15 http://google-code-prettify.googlecode.com/svn/trunk/README.html
- 16 http://softwaremaniacs.org/soft/highlight/en/
- 17 http://google-code-prettify.googlecode.com/svn/trunk/README.html
- 18 http://pluszone.net/blog/projects/beautifierPlus/index.php
- 19 http://pluszone.net/blog/projects/beautifierPlus/index.php
- 20 http://formatter.gerbenvv.nl/version3/index.php?lang=en
- 21 http://formatter.gerbenvv.nl/version3/index.php?lang=en
- 22 http://beautifyphp.sourceforge.net/docs/
- 23 http://elfz.laacz.lv/beautify/?
- 24 http://couponmeister.com/beautify.aspx
- 25 http://tidy.sourceforge.net/
- 26 http://perso.wanadoo.fr/ablavier/TidyGUI/
- 27 http://sourceforge.net/projects/tidy
- 28 http://www.w3.org/People/Raggett/tidy/
- 29 http://www.highdots.com/html-code-export/
- 30 http://csstidy.sourceforge.net/
- 31 http://perltidy.sourceforge.net/
- 32 http://users.skynet.be/mgueury/mozilla/index.html
- 33 http://tidy.sourceforge.net/
- 34 http://www.textrush.com/
- 35 http://www.textrush.com/
- 36 http://www.polystyle.com/
- 37 http://www.waterproof.fr/products/phpCodeBeautifier/
- 38 http://www.digital-mines.com/htb/