Formatter
🧜♀️ A Sublime Text plugin to beautify, minify, convert: CSS, SCSS, Sass, HTML, XML, SVG, JS,JavaScript, JSON, GraphQL, Markdown, TypeScript, Vue, Lua, YAML, Go, Perl, PHP, Python, Ruby, Rust, Haskell, Dart, Swift, Crystal, Bash, Shell, SQL, CSV, C, C++, C#, Objective-C, D, Java, Pawn, Julia, Blade, LaTeX, D2, Graphviz, Mermaid, PlantUML, Disasm..
Install / Use
/learn @bitst0rm-pub/FormatterREADME
🧜♀️ Formatter
Formatter is a versatile config-file-driven plugin for Sublime Text 3 & 4 to beautify and minify source code.<br />
In theory, it can also serve as a platform to transform any form of text, beyond beautifying and minifying.
Key features:
- Supports over 70 major programming languages via plugins.
- Transforms text in various ways:
- Text-to-Text (Text diagramms, ASCII art, etc.)
- Text-to-Image (Image diagramms, QR-code images, etc.)
- Capable to format entire file, single or multiple selections.
- Capable to format entire directory recursively.
- Operates more accurately based on syntax scope, not file extension.
- Works with both saved and unsaved dirty files (buffer).
- Unified settings across different systems.
- Supports auto-detect formatting.
- with the ability to chain multiple formatters sequentially in a single run.
- Supports per-project formatting.
- Capable to format on Save.
- with options to exclude dirs, files, extensions, syntaxes.
- Capable to format on Paste.
- dito
- Shared config files available to get started.
- Displays real-time word and character counts.
- Automatically remembers and restores text position.
- Customizable and extendable through 2 methods to add your own plugins:
- Generic: Adding a portion JSON settings (no coding needed). see Configuration
- Modules: Integration of your own modules (easy API). see Development
- Zero dependencies to install.
Limitations:
-
Text-to-Image: Third-party plugins often rely on a headless browser to render images, making the process very time-consuming. Consequently:
"dir_format"will not be implemented or is disabled."new_file_on_format"will not be implemented or is disabled.- Third-party plugins must support exporting
PNGformat as Sublime Text only supportsPNG,JPG, andGIFimages.
Formatter in action:
| Text-to-Text | Text-to-Image |
| :------------: | :------------: |
|
|
|
| Pretty-printing... | Converting... |
| :------------: | :------------: |
|
|
|
| Not OllyDbg, IDA but... | Assembling... |
| :------------: | :------------: |
|
|
|
<sub>Theme used: theme-dosa and color-scheme-two</sub>
Guides
- Table of Contents
Plugins
Formatter requires third-party plugins to work, as it relies on external plugins to format code. Users must install these plugins themselves. This means, Formatter is not responsible for:
- The quality of formatted code.
- Keeping third-party plugins up-to-date.
Table of supported plugins
Need more? see: Configuration and Development to add your own.
- The same table with clear names, auto generated: _summary.txt
(I)=(integrated/build-in)No installation required; specifically designed for Formatter.None= Mostly standalone binaries.Req.= Requirements might not be up-to-date.
| Langs | Beautifiers | Minifiers | Graphics | Req. | Config |
| ------ | :------: | :------: | :------: | :------: | :------: |
| Angular | prettier, prettierd | -- | -- | Node.js | -- |
| Arduino | uncrustify [1], clang-format [2], artistic style | -- | -- | None | [1], [2] |
| Assembly | asmfmt, nasmfmt | -- | -- | None | -- |
| Astro | prettier, prettierd | -- | -- | Node.js | -- |
| BibTeX | bibtex-tidy [1] | -- | -- | Node.js 12.0+ | [1] |
| Blade | blade-formatter | -- | -- | Node.js | -- |
| C, C++, C#, Objective-C | uncrustify [1], clang-format [2], artistic style | -- | -- | None | [1], [2] |
| Cabal | cabal-fmt | -- | -- | Haskell | -- |
| Caddyfile | caddy-fmt | -- | -- | None | -- |
| Clojure | cljfmt, zprint | -- | -- | None, (Java) | -- |
| CMake | cmake-format | -- | -- | Python | -- |
| Crystal | crystal tool format | -- | -- | None | -- |
| CSS, SCSS, Sass, Less, SugarSS | stylelint [1], js-beautifier, prettier, prettierd, prettydiff [2], csscomb, stylefmt | cleancss CLI, prettydiff [2] | -- | Node.js | [1], [2] |
| CSV, TSV, DSV, Text | prettytable (I), prettydiff [1] [2] | -- | -- | Python, Node.js [2] | [1] |
| D | uncrustify [1] | -- | -- | None | [1] |
| D2 | d2 fmt | -- | d2 | None | -- |
| Dart | dart-format | -- | -- | Dart | -- |
| Dhall | dhall format | -- | -- | None | -- |
| Dockerfile | dockfmt | -- | -- | None | -- |
| Drawio | -- | -- | draw.io | None | -- |
| Elixir | mix format | -- | -- | Erlang | -- |
| Elm | elm-format | -- | -- | None | -- |
| Erlang | erlfmt [1], efmt | -- | -- | rebar3 [1], None | -- |
| Fortran | fprettify | -- | -- | Python | -- |
| Gleam | gleam format | -- | -- | None | -- |
| GLSL | clang-format [1] | -- | -- | None | [1] |
| Go | gofmt, goimports, gofumpt | -- | -- | None | -- |
| GraphQL | prettier, prettierd | -- | -- | Node.js | -- |
| Graphviz | -- | -- | graphviz | None | -- |
| Groovy, Gradle | npm-groovy-lint | -- | -- | Node.js 12.0+ | -- |
| Haskell | ormolu, fourmolu [1], hindent, stylish-haskell, floskell | -- | -- | Haskell | [1] |
| HCL | hclfmt | -- | -- | None | -- |
| HTML, XHTML, XML | js-beautifier, prettier, prettierd, prettydiff [1], html-tidy | html-minifier, prettydiff [1] | -- | Node.js | [1] |
| Java | google java format [1], uncrustify [2], [clang-format
