2016-07-02 16:28:01 -06:00
# :lipstick: [atom-beautify](https://github.com/Glavin001/atom-beautify)
2017-11-03 20:20:36 -06:00
[![apm ](https://img.shields.io/apm/dm/atom-beautify.svg )](https://atom.io/packages/atom-beautify)
2017-04-15 11:31:55 -06:00
[![GitHub stars ](https://img.shields.io/github/stars/Glavin001/atom-beautify.svg?style=flat-square )](https://github.com/Glavin001/atom-beautify/stargazers)
2018-03-30 10:03:47 -06:00
[![GitHub issues ](https://img.shields.io/github/issues/Glavin001/atom-beautify.svg?style=flat-square )](https://github.com/Glavin001/atom-beautify/issues)
[![Greenkeeper badge ](https://badges.greenkeeper.io/Glavin001/atom-beautify.svg )](https://greenkeeper.io/)
[![Slack ](https://unibeautify-slack.herokuapp.com/badge.svg )](https://unibeautify-slack.herokuapp.com/)
[![Twitter Follow ](https://img.shields.io/twitter/follow/unibeautify.svg?style=social&label=Follow )](https://twitter.com/unibeautify)
2017-04-15 11:31:55 -06:00
[![Gitter ](https://img.shields.io/gitter/room/Glavin001/atom-beautify.svg?style=flat-square )](https://gitter.im/Glavin001/atom-beautify)
[![Bountysource ](https://img.shields.io/bountysource/team/atom-beautify/activity.svg?style=flat-square )](https://www.bountysource.com/teams/atom-beautify)
[![Paypal Donations ](https://www.paypalobjects.com/en_US/i/btn/btn_donate_SM.gif )](https://www.paypal.com/cgi-bin/webscr?cmd=_donations& business=X2RK5DKN6YXPJ& lc=CA& item_name=Atom%2dBeautify& item_number=atom%2dbeautify& currency_code=CAD& bn=PP%2dDonationsBF%3abtn_donate_LG%2egif%3aNonHosted)
2014-03-03 00:51:16 -07:00
2018-01-28 14:52:02 -07:00
**Sign up for Unibeautify CI: [https://goo.gl/jmM4QN ](https://goo.gl/jmM4QN )**
2018-01-17 19:49:01 -07:00
**Help improve Atom-Beautify by completing the quick questionnaire: [https://goo.gl/iEHBNr ](https://goo.gl/iEHBNr )**
2014-03-03 00:51:16 -07:00
2016-09-25 16:45:21 -06:00
| Mac OS < img src = "https://cloud.githubusercontent.com/assets/1885333/17059766/2530c9d8-4ffd-11e6-9529-3fa47dbff616.png" width = "50px" > and < img src = "https://cloud.githubusercontent.com/assets/1885333/17059750/11c4474e-4ffd-11e6-89e1-2486ca5b3234.png" width = "100px" > | < img src = "https://cloud.githubusercontent.com/assets/1885333/17059763/206a7d4a-4ffd-11e6-859e-7856902fb300.png" width = "100px" > |
2016-09-25 16:48:16 -06:00
| --- | --- |
2017-10-07 09:45:13 -06:00
| [Travis CI: ![Build Status ](https://travis-ci.org/Glavin001/atom-beautify.svg?branch=master )](https://travis-ci.org/Glavin001/atom-beautify) | [AppVeyor: ![Build status ](https://ci.appveyor.com/api/projects/status/himnq7tjxl2fdc8u/branch/master?svg=true )](https://ci.appveyor.com/project/Glavin001/atom-beautify/branch/master) |
2015-06-04 11:59:35 -06:00
2015-07-13 07:52:10 -06:00
[![Throughput Graph ](https://graphs.waffle.io/Glavin001/atom-beautify/throughput.svg )](https://waffle.io/Glavin001/atom-beautify/metrics)
2014-08-08 11:38:28 -06:00
2016-07-02 16:28:01 -06:00
> Beautify HTML, CSS, JavaScript, PHP, Python, Ruby, Java, C, C++, C#, Objective-C, CoffeeScript, TypeScript, Coldfusion, SQL, and more in Atom
| Before | After |
| --- | ---- |
| Original HTML | Beautified HTML |
| ![image ](https://cloud.githubusercontent.com/assets/1885333/16542727/db52adc6-408a-11e6-824e-04aed06bd2f7.png ) | ![image ](https://cloud.githubusercontent.com/assets/1885333/16542728/dcac3700-408a-11e6-8e35-9c8fc4432edc.png ) |
## Table of Contents
- [Installation ](#installation )
2017-04-09 23:53:34 -06:00
- [Beautifiers ](#beautifiers )
2016-07-02 16:28:01 -06:00
- [Language Support ](#language-support )
- [Usage ](#usage )
2017-05-06 14:27:28 -06:00
- [Command Palette ](#command-palette )
- [Beautify a Specific Language ](#beautify-a-specific-language )
2016-07-02 16:28:01 -06:00
- [Selection of Code ](#selection-of-code )
- [Beautify On Save ](#beautify-on-save )
- [Keyboard Shortcut ](#keyboard-shortcut )
- [Custom Keyboard Shortcuts ](#custom-keyboard-shortcuts )
- [Configuration ](#configuration )
- [Simple ](#simple )
- [Nested ](#nested-recommended )
- [Troubleshooting ](#troubleshooting )
- [Contributing ](#contributing )
## Installation
2014-03-03 00:51:16 -07:00
2014-06-13 23:21:26 -06:00
Atom Package: https://atom.io/packages/atom-beautify
2014-08-08 11:38:28 -06:00
```bash
apm install atom-beautify
```
2017-10-29 16:41:20 -06:00
Or Settings/Preferences ➔ Install ➔ Search for `atom-beautify`
2014-08-08 11:38:28 -06:00
2016-08-25 10:56:01 -06:00
### Important Notice: Analytics
2017-04-20 08:01:18 -06:00
[Atom-Beautify respects the `core.telemetryConsent` configuration option from Atom editor. ](https://github.com/Glavin001/atom-beautify/issues/1179 )
If you do not wish to have usage data sent to Google Analytics then please set `core.telemetryConsent` to `no` or `undecided` option before using Atom-Beautify.
2016-11-20 02:24:36 -07:00
See [`Anonymous Analytics` section of docs ](docs/options.md#anonymous-analytics ) for details.
2016-08-25 10:56:01 -06:00
Thank you.
2017-04-20 08:01:18 -06:00
| On Atom Load | Change Setting Later |
| --- | --- |
| ![image ](https://cloud.githubusercontent.com/assets/1885333/25234140/947b1b50-25b7-11e7-8ebc-0ae37420f13e.png ) | ![image ](https://cloud.githubusercontent.com/assets/1885333/25234184/b41b4192-25b7-11e7-8185-a83829b48078.png ) |
2016-09-25 22:12:16 -06:00
### Next Version: [Unibeautify](https://github.com/Unibeautify/unibeautify)
Atom-Beautify is going to be completely rewritten with [Unibeautify ](https://github.com/Unibeautify/unibeautify ) at its core!
2016-11-20 02:24:36 -07:00
See [`unibeautify` branch ](../../tree/unibeautify ) for work in progress and [Issue #1174 ](https://github.com/Glavin001/atom-beautify/issues/1174 ).
2016-09-25 22:12:16 -06:00
2017-12-25 01:54:49 -07:00
### Poll: Improving installation of third-party beautifiers
Many users are experiencing issues when installing third party beautifiers (e.g. Uncrustify, PHP-CS-Fixer, and many more).
A possible solution is a "cloud" service which provides remote access to these beautifiers. Atom-Beautify would then communicate with these services, allowing for zero-installation beautification.
Please let us know what you think!
[![ ](https://m131jyck4m.execute-api.us-west-2.amazonaws.com/prod/poll/01BY57P9ACSDQASVT7KYZKZESK/Yes%2C%20cloud%20solution%20would%20be%20great! )](https://m131jyck4m.execute-api.us-west-2.amazonaws.com/prod/poll/01BY57P9ACSDQASVT7KYZKZESK/Yes%2C%20cloud%20solution%20would%20be%20great!/vote)
[![ ](https://m131jyck4m.execute-api.us-west-2.amazonaws.com/prod/poll/01BY57P9ACSDQASVT7KYZKZESK/No%2C%20I%20enjoy%20manually%20installing%20beautifiers )](https://m131jyck4m.execute-api.us-west-2.amazonaws.com/prod/poll/01BY57P9ACSDQASVT7KYZKZESK/No%2C%20I%20enjoy%20manually%20installing%20beautifiers/vote)
[![ ](https://m131jyck4m.execute-api.us-west-2.amazonaws.com/prod/poll/01BY57P9ACSDQASVT7KYZKZESK/No%2C%20I%20am%20happy%20using%20Docker )](https://m131jyck4m.execute-api.us-west-2.amazonaws.com/prod/poll/01BY57P9ACSDQASVT7KYZKZESK/No%2C%20I%20am%20happy%20using%20Docker/vote)
[![ ](https://m131jyck4m.execute-api.us-west-2.amazonaws.com/prod/poll/01BY57P9ACSDQASVT7KYZKZESK/No%2C%20I%20do%20not%20want%20to%20send%20me%20code%20over%20the%20Internet )](https://m131jyck4m.execute-api.us-west-2.amazonaws.com/prod/poll/01BY57P9ACSDQASVT7KYZKZESK/No%2C%20I%20do%20not%20want%20to%20send%20me%20code%20over%20the%20Internet/vote)
2017-04-09 23:53:34 -06:00
## Beautifiers
Some of the supported beautifiers are developed for Node.js and are automatically installed when Atom-Beautify is installed. However, other beautifiers are command-line interface (CLI) applications and require you to manually install them.
2017-06-16 22:38:26 -06:00
| Beautifier | Preinstalled | [:whale: Docker ](https://www.docker.com/ ) | Installation |
| --- | --- | --- |--- |
| align-yaml | :white_check_mark: | :ok_hand: Not necessary | :smiley: Nothing! |
| autopep8 | :warning: 2 executables | :warning: Only 1 of 2 executables | :whale: With [Docker ](https://www.docker.com/ ):< br /> 1. Install [autopep8 (`autopep8`) ](https://github.com/hhatto/autopep8 ) with `docker pull unibeautify/autopep8` < br />< br /> :bookmark_tabs: Manually:< br /> 1. Install [autopep8 (`autopep8`) ](https://github.com/hhatto/autopep8 ) by following https://github.com/hhatto/autopep8#installation< br /> 2. Install [isort (`isort`) ](https://github.com/timothycrosley/isort ) by following https://github.com/timothycrosley/isort#installing-isort< br /> |
| beautysh | :warning: 1 executable | :white_check_mark: :100:% of executables | :whale: With [Docker ](https://www.docker.com/ ):< br /> 1. Install [beautysh (`beautysh`) ](https://github.com/bemeurer/beautysh ) with `docker pull unibeautify/beautysh` < br />< br /> :bookmark_tabs: Manually:< br /> 1. Install [beautysh (`beautysh`) ](https://github.com/bemeurer/beautysh ) by following https://github.com/bemeurer/beautysh#installation< br /> |
2017-10-28 04:53:31 -06:00
| brittany | :warning: Manual installation | :construction: Not an executable | :page_facing_up: Go to https://github.com/lspitzner/brittany and follow the instructions. |
2017-06-16 22:38:26 -06:00
| clang-format | :warning: 1 executable | :white_check_mark: :100:% of executables | :whale: With [Docker ](https://www.docker.com/ ):< br /> 1. Install [ClangFormat (`clang-format`) ](https://clang.llvm.org/docs/ClangFormat.html ) with `docker pull unibeautify/clang-format` < br />< br /> :bookmark_tabs: Manually:< br /> 1. Install [ClangFormat (`clang-format`) ](https://clang.llvm.org/docs/ClangFormat.html ) by following https://clang.llvm.org/docs/ClangFormat.html< br /> |
| cljfmt | :white_check_mark: | :ok_hand: Not necessary | :smiley: Nothing! |
| Coffee Formatter | :white_check_mark: | :ok_hand: Not necessary | :smiley: Nothing! |
| coffee-fmt | :white_check_mark: | :ok_hand: Not necessary | :smiley: Nothing! |
| Crystal | :warning: 1 executable | :white_check_mark: :100:% of executables | :whale: With [Docker ](https://www.docker.com/ ):< br /> 1. Install [Crystal (`crystal`) ](http://crystal-lang.org ) with `docker pull unibeautify/crystal` < br />< br /> :bookmark_tabs: Manually:< br /> 1. Install [Crystal (`crystal`) ](http://crystal-lang.org ) by following https://crystal-lang.org/docs/installation/< br /> |
| CSScomb | :white_check_mark: | :ok_hand: Not necessary | :smiley: Nothing! |
| dfmt | :warning: 1 executable | :x: No Docker support | :bookmark_tabs: Manually:< br /> 1. Install [Dfmt (`dfmt`) ](https://github.com/Hackerpilot/dfmt ) by following https://github.com/dlang-community/dfmt#building< br /> |
| elm-format | :warning: 1 executable | :white_check_mark: :100:% of executables | :whale: With [Docker ](https://www.docker.com/ ):< br /> 1. Install [elm-format (`elm-format`) ](https://github.com/avh4/elm-format ) with `docker pull unibeautify/elm-format` < br />< br /> :bookmark_tabs: Manually:< br /> 1. Install [elm-format (`elm-format`) ](https://github.com/avh4/elm-format ) by following https://github.com/avh4/elm-format#installation-< br /> |
2017-12-06 04:54:50 -07:00
| Emacs Verilog Mode | :warning: 1 executable | :x: No Docker support | :bookmark_tabs: Manually:< br /> 1. Install [Emacs (`emacs`) ](https://www.gnu.org/software/emacs/ ) by following https://www.gnu.org/software/emacs/< br /> |
2017-06-16 22:38:26 -06:00
| erl_tidy | :warning: Manual installation | :construction: Not an executable | :page_facing_up: Go to http://erlang.org/doc/man/erl_tidy.html and follow the instructions. |
| ESLint Fixer | :white_check_mark: | :ok_hand: Not necessary | :smiley: Nothing! |
| formatR | :warning: 1 executable | :white_check_mark: :100:% of executables | :whale: With [Docker ](https://www.docker.com/ ):< br /> 1. Install [Rscript (`rscript`) ](https://github.com/yihui/formatR ) with `docker pull unibeautify/rscript` < br />< br /> :bookmark_tabs: Manually:< br /> 1. Install [Rscript (`rscript`) ](https://github.com/yihui/formatR ) by following https://github.com/yihui/formatR< br /> |
| Fortran Beautifier | :warning: 1 executable | :x: No Docker support | :bookmark_tabs: Manually:< br /> 1. Install [Emacs (`emacs`) ](https://www.gnu.org/software/emacs/ ) by following https://www.gnu.org/software/emacs/< br /> |
| Gherkin formatter | :white_check_mark: | :ok_hand: Not necessary | :smiley: Nothing! |
2018-01-05 01:09:16 -07:00
| GN | :warning: 1 executable | :x: No Docker support | :bookmark_tabs: Manually:< br /> 1. Install [gn (`gn`) ](https://chromium.googlesource.com/chromium/src/tools/gn ) by following https://www.chromium.org/developers/how-tos/get-the-code< br /> |
2017-06-16 22:38:26 -06:00
| gofmt | :warning: Manual installation | :construction: Not an executable | :page_facing_up: Go to https://golang.org/cmd/gofmt/ and follow the instructions. |
2017-06-21 18:30:17 -06:00
| goimports | :warning: 1 executable | :white_check_mark: :100:% of executables | :whale: With [Docker ](https://www.docker.com/ ):< br /> 1. Install [goimports (`goimports`) ](https://godoc.org/golang.org/x/tools/cmd/goimports ) with `docker pull unibeautify/goimports` < br />< br /> :bookmark_tabs: Manually:< br /> 1. Install [goimports (`goimports`) ](https://godoc.org/golang.org/x/tools/cmd/goimports ) by following https://godoc.org/golang.org/x/tools/cmd/goimports< br /> |
2017-06-16 22:38:26 -06:00
| hh_format | :warning: Manual installation | :construction: Not an executable | :page_facing_up: Go to http://hhvm.com/ and follow the instructions. |
2017-10-28 04:53:31 -06:00
| hindent | :warning: Manual installation | :construction: Not an executable | :page_facing_up: Go to https://github.com/commercialhaskell/hindent and follow the instructions. |
2017-06-16 22:38:26 -06:00
| HTML Beautifier | :warning: Manual installation | :construction: Not an executable | :page_facing_up: Go to https://github.com/threedaymonk/htmlbeautifier and follow the instructions. |
| JS Beautify | :white_check_mark: | :ok_hand: Not necessary | :smiley: Nothing! |
| JSCS Fixer | :white_check_mark: | :ok_hand: Not necessary | :smiley: Nothing! |
| Latex Beautify | :warning: Manual installation | :construction: Not an executable | :page_facing_up: Go to https://github.com/cmhughes/latexindent.pl and follow the instructions. |
| Lua beautifier | :white_check_mark: | :ok_hand: Not necessary | :smiley: Nothing! |
| Marko Beautifier | :white_check_mark: | :ok_hand: Not necessary | :smiley: Nothing! |
| Nginx Beautify | :white_check_mark: | :ok_hand: Not necessary | :smiley: Nothing! |
2017-11-11 12:45:30 -07:00
| ocp-indent | :warning: 1 executable | :white_check_mark: :100:% of executables | :whale: With [Docker ](https://www.docker.com/ ):< br /> 1. Install [ocp-indent (`ocp-indent`) ](https://www.typerex.org/ocp-indent.html ) with `docker pull unibeautify/ocp-indent` < br />< br /> :bookmark_tabs: Manually:< br /> 1. Install [ocp-indent (`ocp-indent`) ](https://www.typerex.org/ocp-indent.html ) by following https://www.typerex.org/ocp-indent.html#installation< br /> |
2017-06-16 22:38:26 -06:00
| Perltidy | :warning: Manual installation | :construction: Not an executable | :page_facing_up: Go to http://perltidy.sourceforge.net/ and follow the instructions. |
| PHP-CS-Fixer | :warning: 2 executables | :warning: Only 1 of 2 executables | :whale: With [Docker ](https://www.docker.com/ ):< br /> 1. Install [PHP-CS-Fixer (`php-cs-fixer`) ](https://github.com/FriendsOfPHP/PHP-CS-Fixer ) with `docker pull unibeautify/php-cs-fixer` < br />< br /> :bookmark_tabs: Manually:< br /> 1. Install [PHP (`php`) ](http://php.net/ ) by following http://php.net/manual/en/install.php< br /> 2. Install [PHP-CS-Fixer (`php-cs-fixer`) ](https://github.com/FriendsOfPHP/PHP-CS-Fixer ) by following https://github.com/FriendsOfPHP/PHP-CS-Fixer#installation< br /> |
2017-06-19 21:08:41 -06:00
| PHPCBF | :warning: 2 executables | :warning: Only 1 of 2 executables | :whale: With [Docker ](https://www.docker.com/ ):< br /> 1. Install [PHPCBF (`phpcbf`) ](https://github.com/squizlabs/PHP_CodeSniffer ) with `docker pull unibeautify/phpcbf` < br />< br /> :bookmark_tabs: Manually:< br /> 1. Install [PHP (`php`) ](http://php.net/ ) by following http://php.net/manual/en/install.php< br /> 2. Install [PHPCBF (`phpcbf`) ](https://github.com/squizlabs/PHP_CodeSniffer ) by following https://github.com/squizlabs/PHP_CodeSniffer#installation< br /> |
2018-02-18 23:09:53 -07:00
| Prettier | :white_check_mark: | :ok_hand: Not necessary | :smiley: Nothing! |
2017-06-16 22:38:26 -06:00
| Pretty Diff | :white_check_mark: | :ok_hand: Not necessary | :smiley: Nothing! |
| Pug Beautify | :white_check_mark: | :ok_hand: Not necessary | :smiley: Nothing! |
2018-01-08 12:31:30 -07:00
| puppet-lint | :warning: 1 executable | :white_check_mark: :100:% of executables | :whale: With [Docker ](https://www.docker.com/ ):< br /> 1. Install [puppet-lint (`puppet-lint`) ](http://puppet-lint.com/ ) with `docker pull unibeautify/puppet-lint` < br />< br /> :bookmark_tabs: Manually:< br /> 1. Install [puppet-lint (`puppet-lint`) ](http://puppet-lint.com/ ) by following http://puppet-lint.com/< br /> |
2017-06-16 22:38:26 -06:00
| pybeautifier | :warning: Manual installation | :construction: Not an executable | :page_facing_up: Go to https://github.com/guyskk/pybeautifier and follow the instructions. |
| Remark | :white_check_mark: | :ok_hand: Not necessary | :smiley: Nothing! |
2018-03-05 09:29:24 -07:00
| Rubocop | :warning: 1 executable | :x: No Docker support | :bookmark_tabs: Manually:< br /> 1. Install [Rubocop (`rubocop`) ](http://rubocop.readthedocs.io/ ) by following http://rubocop.readthedocs.io/en/latest/installation/< br /> |
2017-06-16 22:38:26 -06:00
| Ruby Beautify | :warning: Manual installation | :construction: Not an executable | :page_facing_up: Go to https://github.com/erniebrodeur/ruby-beautify and follow the instructions. |
2017-07-16 06:36:34 -06:00
| rustfmt | :warning: Manual installation | :construction: Not an executable | :page_facing_up: Go to https://github.com/rust-lang-nursery/rustfmt and follow the instructions. |
2017-06-16 22:38:26 -06:00
| SassConvert | :warning: 1 executable | :white_check_mark: :100:% of executables | :whale: With [Docker ](https://www.docker.com/ ):< br /> 1. Install [SassConvert (`sass-convert`) ](http://sass-lang.com/documentation/file.SASS_REFERENCE.html#syntax ) with `docker pull unibeautify/sass-convert` < br />< br /> :bookmark_tabs: Manually:< br /> 1. Install [SassConvert (`sass-convert`) ](http://sass-lang.com/documentation/file.SASS_REFERENCE.html#syntax ) by following http://sass-lang.com/documentation/file.SASS_REFERENCE.html#syntax< br /> |
| sqlformat | :warning: Manual installation | :construction: Not an executable | :page_facing_up: Go to https://github.com/andialbrecht/sqlparse and follow the instructions. |
| stylish-haskell | :warning: Manual installation | :construction: Not an executable | :page_facing_up: Go to https://github.com/jaspervdj/stylish-haskell and follow the instructions. |
2017-10-10 09:36:29 -06:00
| terraformfmt | :warning: 1 executable | :white_check_mark: :100:% of executables | :whale: With [Docker ](https://www.docker.com/ ):< br /> 1. Install [Terraform (`terraform`) ](https://www.terraform.io ) with `docker pull hashicorp/terraform` < br />< br /> :bookmark_tabs: Manually:< br /> 1. Install [Terraform (`terraform`) ](https://www.terraform.io ) by following https://www.terraform.io< br /> |
2017-06-16 22:38:26 -06:00
| Tidy Markdown | :white_check_mark: | :ok_hand: Not necessary | :smiley: Nothing! |
| TypeScript Formatter | :white_check_mark: | :ok_hand: Not necessary | :smiley: Nothing! |
| Uncrustify | :warning: 1 executable | :white_check_mark: :100:% of executables | :whale: With [Docker ](https://www.docker.com/ ):< br /> 1. Install [Uncrustify (`uncrustify`) ](http://uncrustify.sourceforge.net/ ) with `docker pull unibeautify/uncrustify` < br />< br /> :bookmark_tabs: Manually:< br /> 1. Install [Uncrustify (`uncrustify`) ](http://uncrustify.sourceforge.net/ ) by following https://github.com/uncrustify/uncrustify< br /> |
2018-03-01 18:10:48 -07:00
| VHDL Beautifier | :warning: 1 executable | :x: No Docker support | :bookmark_tabs: Manually:< br /> 1. Install [Emacs (`emacs`) ](https://www.gnu.org/software/emacs/ ) by following https://www.gnu.org/software/emacs/< br /> |
2017-06-16 22:38:26 -06:00
| Vue Beautifier | :white_check_mark: | :ok_hand: Not necessary | :smiley: Nothing! |
| yapf | :warning: Manual installation | :construction: Not an executable | :page_facing_up: Go to https://github.com/google/yapf and follow the instructions. |
2016-09-25 22:12:16 -06:00
2014-06-12 22:25:39 -06:00
## Language Support
2016-11-20 02:24:36 -07:00
See [all supported options in the documentation at `docs/options.md` ](docs/options.md ).
2016-07-02 16:28:01 -06:00
| Language | Grammars | File Extensions | Supported Beautifiers |
| --- | --- | --- | ---- |
2017-06-16 22:38:26 -06:00
| Apex | `Apex` |`.cls`, `.trigger` | ** [`Uncrustify` ](https://github.com/uncrustify/uncrustify )** |
| Arduino | `Arduino` |`.ino`, `.pde` | ** [`Uncrustify` ](https://github.com/uncrustify/uncrustify )** |
| Bash | `Shell Script` |`.bash`, `.sh` | ** [`beautysh` ](https://github.com/bemeurer/beautysh )** |
2018-03-19 10:43:22 -06:00
| Blade | `Blade` |`.blade.php` | ** [`JS Beautify` ](https://github.com/beautify-web/js-beautify )** |
2017-06-16 22:38:26 -06:00
| C | `C` , `opencl` |`.h`, `.c` , `.cl` | ** [`Uncrustify` ](https://github.com/uncrustify/uncrustify )**, [`clang-format` ](https://clang.llvm.org/docs/ClangFormat.html ) |
| Coldfusion | `html` |`.cfm`, `.cfml` , `.cfc` | ** [`Pretty Diff` ](https://github.com/prettydiff/prettydiff )** |
| Clojure | `Clojure` |`.clj`, `.cljs` , `.edn` | ** [`cljfmt` ](https://github.com/snoe/node-cljfmt )** |
| CoffeeScript | `CoffeeScript` |`.coffee` | ** [`coffee-fmt` ](https://github.com/sterpe/coffee-fmt )**, [`Coffee Formatter` ](https://github.com/Glavin001/Coffee-Formatter ) |
| C++ | `C++` |`.h`, `.hh` , `.cc` , `.cpp` , `.cxx` , `.C` , `.cu` , `.c++` , `.hpp` , `.hxx` , `.h++` , `.cuh` | ** [`Uncrustify` ](https://github.com/uncrustify/uncrustify )**, [`clang-format` ](https://clang.llvm.org/docs/ClangFormat.html ) |
| Crystal | `Crystal` |`.cr` | ** [`Crystal` ](http://crystal-lang.org )** |
| C# | `C#` |`.cs` | ** [`Uncrustify` ](https://github.com/uncrustify/uncrustify )** |
2018-02-18 23:09:53 -07:00
| CSS | `CSS` |`.css` | ** [`JS Beautify` ](https://github.com/beautify-web/js-beautify )**, [`CSScomb` ](https://github.com/csscomb/csscomb.js ), [`Prettier` ](https://github.com/prettier/prettier ), [`Pretty Diff` ](https://github.com/prettydiff/prettydiff ), [`SassConvert` ](http://sass-lang.com/documentation/file.SASS_REFERENCE.html#syntax ) |
2017-06-16 22:38:26 -06:00
| CSV | `CSV` |`.csv` | ** [`Pretty Diff` ](https://github.com/prettydiff/prettydiff )** |
| D | `D` |`.d` | ** [`Uncrustify` ](https://github.com/uncrustify/uncrustify )**, [`dfmt` ](https://github.com/Hackerpilot/dfmt ) |
| EJS | `EJS` , `JavaScript Template` , `HTML (Angular)` |`.ejs` | ** [`JS Beautify` ](https://github.com/beautify-web/js-beautify )**, [`Pretty Diff` ](https://github.com/prettydiff/prettydiff ) |
| Elm | `Elm` |`.elm` | ** [`elm-format` ](https://github.com/avh4/elm-format )** |
| ERB | `HTML (Ruby - ERB)` , `HTML (Rails)` |`.erb` | ** [`Pretty Diff` ](https://github.com/prettydiff/prettydiff )**, [`HTML Beautifier` ](https://github.com/threedaymonk/htmlbeautifier ) |
| Erlang | `Erlang` |`.erl` | ** [`erl_tidy` ](http://erlang.org/doc/man/erl_tidy.html )** |
2017-06-19 19:20:49 -06:00
| Fortran | `Fortran - Modern` |`.f90`, `.F90` , `.f95` , `.F95` , `.f03` , `.F03` , `.f08` , `.F08` | ** [`Fortran Beautifier` ](https://www.gnu.org/software/emacs/ )** |
2017-06-16 22:38:26 -06:00
| gherkin | `Gherkin` |`.feature` | ** [`Gherkin formatter` ](https://github.com/Glavin001/atom-beautify/blob/master/src/beautifiers/gherkin.coffee )** |
| GLSL | `C` , `opencl` , `GLSL` |`.vert`, `.frag` | ** [`clang-format` ](https://clang.llvm.org/docs/ClangFormat.html )** |
2018-01-05 01:09:16 -07:00
| GN | `gn` |`.gn`, `.gni` | ** [`GN` ](https://chromium.googlesource.com/chromium/src/tools/gn )** |
2017-06-18 21:49:20 -06:00
| Go | `Go` |`.go` | ** [`gofmt` ](https://golang.org/cmd/gofmt/ )**, [`goimports` ](https://godoc.org/golang.org/x/tools/cmd/goimports ) |
2017-06-16 22:38:26 -06:00
| Golang Template | `HTML (Go)` , `Go Template` |`.gohtml` | ** [`Pretty Diff` ](https://github.com/prettydiff/prettydiff )** |
| Handlebars | `Handlebars` , `HTML (Handlebars)` |`.hbs`, `.handlebars` | ** [`JS Beautify` ](https://github.com/beautify-web/js-beautify )**, [`Pretty Diff` ](https://github.com/prettydiff/prettydiff ) |
2018-03-01 17:27:54 -07:00
| Haskell | `Haskell` |`.hs` | ** [`stylish-haskell` ](https://github.com/jaspervdj/stylish-haskell )**, [`brittany` ](https://github.com/lspitzner/brittany ), [`hindent` ](https://github.com/commercialhaskell/hindent ) |
2017-06-16 22:38:26 -06:00
| HTML | `HTML` |`.html` | ** [`JS Beautify` ](https://github.com/beautify-web/js-beautify )**, [`Pretty Diff` ](https://github.com/prettydiff/prettydiff ) |
| Jade | `Jade` , `Pug` |`.jade`, `.pug` | ** [`Pug Beautify` ](https://github.com/vingorius/pug-beautify )** |
| Java | `Java` |`.java` | ** [`Uncrustify` ](https://github.com/uncrustify/uncrustify )** |
2018-02-18 23:09:53 -07:00
| JavaScript | `JavaScript` |`.js` | ** [`JS Beautify` ](https://github.com/beautify-web/js-beautify )**, [`ESLint Fixer` ](https://github.com/eslint/eslint ), [`JSCS Fixer` ](https://github.com/jscs-dev/node-jscs/ ), [`Prettier` ](https://github.com/prettier/prettier ), [`Pretty Diff` ](https://github.com/prettydiff/prettydiff ) |
| JSON | `JSON` |`.json` | ** [`JS Beautify` ](https://github.com/beautify-web/js-beautify )**, [`Prettier` ](https://github.com/prettier/prettier ), [`Pretty Diff` ](https://github.com/prettydiff/prettydiff ) |
2017-06-16 22:38:26 -06:00
| JSX | `JSX` , `JavaScript (JSX)` , `Babel ES6 JavaScript` , `JavaScript with JSX` |`.jsx`, `.js` | ** [`Pretty Diff` ](https://github.com/prettydiff/prettydiff )**, [`JS Beautify` ](https://github.com/beautify-web/js-beautify ) |
| LaTeX | `BibTeX` , `LaTeX` , `TeX` |`.bib`, `.tex` , `.sty` , `.cls` , `.dtx` , `.ins` , `.bbx` , `.cbx` | ** [`Latex Beautify` ](https://github.com/cmhughes/latexindent.pl )** |
2018-02-18 23:09:53 -07:00
| LESS | `LESS` |`.less` | ** [`Pretty Diff` ](https://github.com/prettydiff/prettydiff )**, [`CSScomb` ](https://github.com/csscomb/csscomb.js ), [`Prettier` ](https://github.com/prettier/prettier ) |
2017-10-07 09:45:13 -06:00
| Lua | `Lua` |`.lua`, `.ttslua` | ** [`Lua beautifier` ](https://github.com/Glavin001/atom-beautify/blob/master/src/beautifiers/lua-beautifier/beautifier.coffee )** |
2018-03-01 19:39:35 -07:00
| Markdown | `GitHub Markdown` |`.markdown`, `.md` | ** [`Remark` ](https://github.com/remarkjs/remark )**, [`Prettier` ](https://github.com/prettier/prettier ), [`Tidy Markdown` ](https://github.com/slang800/tidy-markdown ) |
2017-06-16 22:38:26 -06:00
| Marko | `Marko` |`.marko` | ** [`Marko Beautifier` ](https://github.com/marko-js/marko-prettyprint )** |
| Mustache | `HTML (Mustache)` |`.mustache` | ** [`JS Beautify` ](https://github.com/beautify-web/js-beautify )**, [`Pretty Diff` ](https://github.com/prettydiff/prettydiff ) |
| Nginx | `nginx` |`.conf` | ** [`Nginx Beautify` ](https://github.com/denysvitali/nginxbeautify )** |
| Nunjucks | `Nunjucks` , `Nunjucks Templates` , `HTML (Nunjucks Templates)` |`.njk`, `.nunjucks` | ** [`Pretty Diff` ](https://github.com/prettydiff/prettydiff )** |
| Objective-C | `Objective-C` , `Objective-C++` |`.m`, `.mm` , `.h` | ** [`Uncrustify` ](https://github.com/uncrustify/uncrustify )**, [`clang-format` ](https://clang.llvm.org/docs/ClangFormat.html ) |
| OCaml | `OCaml` |`.ml` | ** [`ocp-indent` ](https://www.typerex.org/ocp-indent.html )** |
| Pawn | `Pawn` | | ** [`Uncrustify` ](https://github.com/uncrustify/uncrustify )** |
| Perl | `Perl` , `Perl 6` |`.pl`, `.PL` , `.pm` , `.pod` , `.t` | ** [`Perltidy` ](http://perltidy.sourceforge.net/ )** |
| PHP | `PHP` |`.php`, `.module` , `.inc` | ** [`PHP-CS-Fixer` ](https://github.com/FriendsOfPHP/PHP-CS-Fixer )**, [`PHPCBF` ](http://php.net/manual/en/install.php ), [`hh_format` ](http://hhvm.com/ ) |
| Puppet | `Puppet` |`.pp` | ** [`puppet-lint` ](http://puppet-lint.com/ )** |
2017-11-15 13:53:04 -07:00
| Python | `Python` , `MagicPython` |`.py` | ** [`autopep8` ](https://github.com/hhatto/autopep8 )**, [`pybeautifier` ](https://github.com/guyskk/pybeautifier ), [`yapf` ](https://github.com/google/yapf ) |
2017-06-16 22:38:26 -06:00
| R | `R` |`.r`, `.R` | ** [`formatR` ](https://github.com/yihui/formatR )** |
| Riot.js | `Riot.js` , `HTML (Riot Tag)` |`.tag` | ** [`Pretty Diff` ](https://github.com/prettydiff/prettydiff )** |
| Ruby | `Ruby` , `Ruby on Rails` |`.rb` | ** [`Rubocop` ](https://github.com/bbatsov/rubocop )**, [`Ruby Beautify` ](https://github.com/erniebrodeur/ruby-beautify ) |
2017-07-16 06:36:34 -06:00
| Rust | `Rust` |`.rs`, `.rlib` | ** [`rustfmt` ](https://github.com/rust-lang-nursery/rustfmt )** |
2017-06-16 22:38:26 -06:00
| Sass | `Sass` |`.sass` | ** [`SassConvert` ](http://sass-lang.com/documentation/file.SASS_REFERENCE.html#syntax )** |
2018-02-18 23:09:53 -07:00
| SCSS | `SCSS` |`.scss` | ** [`Pretty Diff` ](https://github.com/prettydiff/prettydiff )**, [`CSScomb` ](https://github.com/csscomb/csscomb.js ), [`Prettier` ](https://github.com/prettier/prettier ), [`SassConvert` ](http://sass-lang.com/documentation/file.SASS_REFERENCE.html#syntax ) |
2017-06-16 22:38:26 -06:00
| Spacebars | `Spacebars` | | ** [`Pretty Diff` ](https://github.com/prettydiff/prettydiff )** |
| SQL | `SQL (Rails)` , `SQL` |`.sql` | ** [`sqlformat` ](https://github.com/andialbrecht/sqlparse )** |
| SVG | `SVG` |`.svg` | ** [`Pretty Diff` ](https://github.com/prettydiff/prettydiff )** |
| Swig | `HTML (Swig)` , `SWIG` |`.swig` | ** [`Pretty Diff` ](https://github.com/prettydiff/prettydiff )** |
2017-10-09 14:09:06 -06:00
| Terraform | `Terraform` |`.tf` | ** [`terraformfmt` ](https://www.terraform.io/docs/commands/fmt.html )** |
2017-06-16 22:38:26 -06:00
| TSS | `TSS` |`.tss` | ** [`Pretty Diff` ](https://github.com/prettydiff/prettydiff )** |
2018-01-30 16:35:23 -07:00
| TSX | `TypeScriptReact` |`.tsx` | ** [`TypeScript Formatter` ](https://github.com/vvakame/typescript-formatter )** |
2017-06-16 22:38:26 -06:00
| Twig | `HTML (Twig)` |`.twig` | ** [`Pretty Diff` ](https://github.com/prettydiff/prettydiff )** |
2018-02-20 13:49:58 -07:00
| TypeScript | `TypeScript` |`.ts` | ** [`TypeScript Formatter` ](https://github.com/vvakame/typescript-formatter )**, [`Prettier` ](https://github.com/prettier/prettier ) |
2017-06-16 22:38:26 -06:00
| UX Markup | `UX` |`.ux` | ** [`Pretty Diff` ](https://github.com/prettydiff/prettydiff )** |
| Vala | `Vala` |`.vala`, `.vapi` | ** [`Uncrustify` ](https://github.com/uncrustify/uncrustify )** |
2017-12-06 04:54:50 -07:00
| Verilog | `Verilog` |`.svh`, `.v` , `.sv` | ** [`Emacs Verilog Mode` ](https://www.veripool.org/projects/verilog-mode/ )** |
2018-03-01 18:10:48 -07:00
| VHDL | `VHDL 2008` |`.vhd`, `.VHD` | ** [`VHDL Beautifier` ](https://www.gnu.org/software/emacs/ )** |
2017-06-16 22:38:26 -06:00
| Visualforce | `Visualforce` |`.page` | ** [`Pretty Diff` ](https://github.com/prettydiff/prettydiff )** |
2018-03-01 20:48:23 -07:00
| Vue | `Vue Component` |`.vue` | ** [`Vue Beautifier` ](https://github.com/Glavin001/atom-beautify/blob/master/src/beautifiers/vue-beautifier.coffee )**, [`ESLint Fixer` ](https://github.com/eslint/eslint ), [`Prettier` ](https://github.com/prettier/prettier ) |
2017-06-16 22:38:26 -06:00
| XML | `SLD` , `XML` , `XHTML` , `XSD` , `XSL` , `JSP` , `GSP` |`.sld`, `.xml` , `.xhtml` , `.xsd` , `.xsl` , `.jsp` , `.gsp` , `.plist` , `.recipe` , `.config` | ** [`Pretty Diff` ](https://github.com/prettydiff/prettydiff )**, [`JS Beautify` ](https://github.com/beautify-web/js-beautify ) |
| XTemplate | `XTemplate` |`.xtemplate` | ** [`Pretty Diff` ](https://github.com/prettydiff/prettydiff )** |
| YAML | `YAML` |`.yml`, `.yaml` | ** [`align-yaml` ](https://github.com/jonschlinkert/align-yaml )** |
2014-06-15 15:37:11 -06:00
2014-03-03 00:51:16 -07:00
## Usage
2017-05-06 14:27:28 -06:00
### Command Palette
2016-07-02 16:28:01 -06:00
Open the [Command Palette ](https://github.com/atom/command-palette ), type `Beautify` , and run `Beautify Editor` .
![image ](https://cloud.githubusercontent.com/assets/1885333/16542583/1c8d975c-4085-11e6-8307-e35df7430a10.png )
2017-05-06 14:27:28 -06:00
#### Beautify a Specific Language
You can use the [Command Palette ](https://github.com/atom/command-palette ) to beautify the editor for a specific language.
The commands are in the form `Atom Beautify: Beautify Language {NAME}` (i.e. `atom-beautify:beautify-language-{NAME}` for keyboard shortcuts).
For example, you may want to beautify `JavaScript` code within a `HTML` file.
![atom-beautify-language-commands ](https://cloud.githubusercontent.com/assets/1885333/25775586/f3fc7ec4-327e-11e7-8576-45e735e80032.gif )
2016-07-02 16:28:01 -06:00
### Selection of Code
2014-06-12 18:33:17 -06:00
2015-06-01 06:07:51 -06:00
It will only beautify selected text if a selection is found -- if not, the whole file will be beautified.
2014-06-12 18:33:17 -06:00
2016-07-02 16:28:01 -06:00
| Selection of Code | Beautify Selection of Code | Beautify Entire File |
| --- | --- | --- |
| Select code in Atom editor | Only that selection is beautified | Without a selection all code is beautified |
| ![image ](https://cloud.githubusercontent.com/assets/1885333/16542597/b3f90c84-4085-11e6-8a0e-1b8604ae385c.png ) | ![image ](https://cloud.githubusercontent.com/assets/1885333/16542598/b5a86b10-4085-11e6-80cf-0afaf1a819c3.png ) | ![image ](https://cloud.githubusercontent.com/assets/1885333/16542603/b798ec24-4085-11e6-880e-8d3a2741940f.png ) |
### Beautify On Save
`Beautify On Save` can be enabled for each language individually.
For example, for language `HTML` go into Atom-Beautify's package settings (`Atom` ➔ `Preferences` ➔ Search for `atom-beautify` ), find `HTML` , and toggle the `Beautify On Save` option.
![atom-beautify-setup-beautify-on-save ](https://cloud.githubusercontent.com/assets/1885333/16542692/3e781e74-4089-11e6-9cf2-5a19af161093.gif )
### Keyboard Shortcut
2014-03-03 00:51:16 -07:00
2016-04-07 18:25:55 -06:00
You can also type < kbd > Ctrl</ kbd > -< kbd > Alt</ kbd > -< kbd > B</ kbd > as a shortcut or click `Packages > Beautify` in the menu.
2014-03-03 00:51:16 -07:00
2014-07-12 09:02:21 -06:00
#### Custom Keyboard Shortcuts
2015-10-10 16:01:30 -06:00
See [Keymaps In-Depth ](https://atom.io/docs/latest/behind-atom-keymaps-in-depth ) for more details.
2014-07-12 09:02:21 -06:00
For example:
```coffeescript
2015-01-01 20:34:04 -07:00
'.editor':
2015-05-06 10:00:51 -06:00
'ctrl-alt-b': 'atom-beautify:beautify-editor'
2014-07-12 09:02:21 -06:00
```
2014-06-12 18:33:17 -06:00
## Configuration
Edit your `.jsbeautifyrc` file in any of the following locations:
2016-11-20 02:24:36 -07:00
- Atom Package Settings
2014-06-15 15:37:11 -06:00
`Atom` ➔ `Preferences` ➔ Search for `atom-beautify`
2014-06-12 18:33:17 -06:00
- Same directory as current file
2016-11-20 02:24:36 -07:00
- Project root
2014-06-12 18:33:17 -06:00
`atom-beautify` will recursively look up from the current file's directory to find `.jsbeautifyrc` .
2015-06-01 06:07:51 -06:00
- Your user's home directory
2014-06-12 18:33:17 -06:00
2014-06-12 22:25:39 -06:00
**Note**: *Comments are supported in `.jsbeautifyrc` thanks to [strip-json-comments](https://github.com/sindresorhus/strip-json-comments).*
2016-11-20 02:24:36 -07:00
See examples of both ways inside [`examples/` ](examples )
2014-06-12 22:25:39 -06:00
2016-11-20 02:24:36 -07:00
See [all supported options in the documentation at `docs/options.md` ](docs/options.md ).
2014-09-11 09:48:15 -06:00
2014-06-12 22:25:39 -06:00
### Simple
2016-11-20 02:24:36 -07:00
See [examples/simple-jsbeautifyrc/.jsbeautifyrc ](examples/simple-jsbeautifyrc/.jsbeautifyrc ).
2014-06-12 22:25:39 -06:00
```json
{
"indent_size": 2,
"indent_char": " ",
"other": " ",
"indent_level": 0,
"indent_with_tabs": false,
"preserve_newlines": true,
"max_preserve_newlines": 2,
"jslint_happy": true,
"indent_handlebars": true
}
```
2016-07-02 16:28:01 -06:00
### Nested (Recommended)
2014-06-12 22:25:39 -06:00
2016-11-20 02:24:36 -07:00
See [examples/nested-jsbeautifyrc/.jsbeautifyrc ](examples/nested-jsbeautifyrc/.jsbeautifyrc ).
2014-06-12 22:25:39 -06:00
```json
{
"html": {
"brace_style": "collapse",
"indent_char": " ",
"indent_scripts": "normal",
"indent_size": 6,
"max_preserve_newlines": 1,
"preserve_newlines": true,
"unformatted": ["a", "sub", "sup", "b", "i", "u"],
"wrap_line_length": 0
},
"css": {
"indent_char": " ",
"indent_size": 4
},
"js": {
"indent_size": 2,
"indent_char": " ",
"indent_level": 0,
"indent_with_tabs": false,
"preserve_newlines": true,
"max_preserve_newlines": 2,
"jslint_happy": true
2014-06-13 23:21:26 -06:00
},
"sql": {
"indent_size": 4,
"indent_char": " ",
"indent_level": 0,
"indent_with_tabs": false
2014-06-12 22:25:39 -06:00
}
}
```
2014-06-12 21:16:39 -06:00
2016-07-02 16:28:01 -06:00
## Troubleshooting
2016-11-20 02:24:36 -07:00
See [`docs/troubleshooting.md` ](docs/troubleshooting.md ).
2016-07-02 16:28:01 -06:00
2014-06-12 18:33:17 -06:00
## Contributing
2017-11-03 20:20:36 -06:00
See [`CONTRIBUTING.md` ](CONTRIBUTING.md ).
2016-11-20 02:24:36 -07:00
[See all contributors on GitHub ](../../graphs/contributors ).
2014-06-12 18:33:17 -06:00
2016-11-20 02:24:36 -07:00
Please update the [CHANGELOG.md ](CHANGELOG.md ),
add yourself as a contributor to the [package.json ](package.json ),
2015-12-10 09:46:07 -07:00
and submit a [Pull Request on GitHub ](https://help.github.com/articles/using-pull-requests/ ).
2014-05-19 00:04:56 -06:00
2014-03-03 00:51:16 -07:00
## License
2016-11-20 02:24:36 -07:00
[MIT ](LICENSE.md ) © [Glavin Wiechert ](https://github.com/Glavin001 )