Greasy Fork is available in English.

[lib] js-beautify

Reformat the code to readble format

Ce script ne doit pas être installé directement. C'est une librairie destinée à être incluse dans d'autres scripts avec la méta-directive // @require

0 0 0
Mis à jour
S'applique à
Tous les sites

Description de l'auteur

This has been set to auto-update from its official GitHub repo, you may also intrested to visit the Homepage.

You might want to require Lib Export Holder before @require this script, to prevent the library writes to global window scope.


For official usage document, see here.

// With [ Lib Export Holder ]
exports.js_beautify ('The Code', { options });

// Without [ Lib Export Holder ]
window.js_beautify ('The Code', { options });

// Options available
    "indent_size": 4,
    "indent_char": " ",
    "indent_level": 0,
    "indent_with_tabs": false,
    "preserve_newlines": true,
    "max_preserve_newlines": 10,
    "jslint_happy": false,
    "space_after_anon_function": false,
    "brace_style": "collapse",
    "keep_array_indentation": false,
    "keep_function_indentation": false,
    "space_before_conditional": true,
    "break_chained_methods": false,
    "eval_code": false,
    "unescape_strings": false,
    "wrap_line_length": 0


You are free to use this in any way you want, in case you find this useful or working for you but you must keep the copyright notice and license. (MIT)


  • Written by Einar Lielmanis,
  • Python version flourished by Stefano Sanfilippo
  • General maintenance and expansion by Liam Newman
  • Command-line for node.js by Daniel Stockman

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