Beautifier for javascript
Go to file
2011-06-22 20:53:47 +03:00
attic It's official: python/jsbeautifier.py 2011-03-27 23:32:08 +03:00
jquery Use the space in a more meaningful way. 2011-05-02 16:16:34 +03:00
python Proper python2 support 2011-06-22 01:58:53 +03:00
tests Fix #45, wrong behavior with indent_level > 0 2011-06-12 20:35:01 +03:00
unpackers bookmarklet_unpacker -> urlencode_unpacker 2011-04-26 11:57:14 +03:00
beautify-html.js Fix HTML indentation with tab character 2011-06-12 23:38:01 +03:00
beautify.js Fix #45, wrong behavior with indent_level > 0 2011-06-12 20:35:01 +03:00
index.html Prettify the submit button 2011-06-22 20:53:47 +03:00
license.txt It's official: python/jsbeautifier.py 2011-03-27 23:32:08 +03:00
Makefile Add my makefile and cli-spidermonkey-tester 2011-06-12 20:30:32 +03:00
README.md readme.txt -> README.md 2011-06-06 21:33:45 +03:00

JS Beautifier

...or, more specifically, all of the code powering jsbeautifier.org.

This little beautifier will reformat and reindent bookmarklets, ugly JavaScript, unpack scripts packed by Dean Edwards popular packer, as well as deobfuscate scripts processed by javascriptobfuscator.com.

To beautify from the command-line you can use provided jsbeautifer.py script/library. Run it to see its usage information; e.g ./jsbeautifier.py file.js beautifies a file, output goes to stdout.

To use jsbeautifier.py as a library is simple:

import jsbeautifier
res = jsbeautifier.beautify('your javascript string')
res = jsbeautifier.beautify_file('some_file.js')

...or, to specify some options:

opts = jsbeautifier.default_options()
opts.indent_size = 2
res = jsbeautifier.beautify('some javascript', opts)

Note that only the HTML+JS version supports unpacking various packers.

You are free to use this in any way you want, in case you find this useful or working for you.

Written by Einar Lielmanis, einar@jsbeautifier.org

Thanks to Jason Diamond, Patrick Hof, Nochum Sossonko, Andreas Schneider, Dave Vasilevsky, Vital Batmanov, Ron Baldwin, Gabriel Harrison, Chris J. Hull, Mathias Bynens and others.