Greasy Fork is available in English.

[lib] js-beautify

Reformat the code to readble format

Dieses Skript sollte nicht direkt installiert werden. Es handelt sich hier um eine Bibliothek für andere Skripte, welche über folgenden Befehl in den Metadaten eines Skriptes eingebunden wird // @require

Erstellt am
Letzte Aktualisierung

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.