- Beautify
- Format Javascript, Typescript, JSON, CSS, SCSS, LESS, HTML and XML using JS-Beautify.
- 59417 Installs
Readme
Beautify for Nova
Beautify integrates JS-Beautify into Nova for formatting Javascript, Typescript, JSON, CSS, SCSS, LESS, HTML and XML.
Configuration
- Formatting is based on the syntax mode of the editor
- Indentation settings are inherited from the editor
- Line endings are inherited from the open document
- Other configuration options can be set as global preferences
- Option to format selection or whole document as specific syntax
- Option to format on save, settable per syntax in global preferences
Invoking
- Via shortcut
⌥⇧F
- Via menu
Editor > Beautify > Format
- Via command palette
⌘⇧P
and then typeFormat
- Via command palette
⌘⇧P
and then typeFormat as JSON
,Format as CSS
,Format as ...
- Automatically formats any selected text or the whole document if there was no selection
Additional syntaxes
Additional syntaxes provided by other Nova extension can be added upon request. Please create an issue at GitHub and provide the necessary information.
Please note that JS-Beautify is only made to format (and know about) HTML, Javascript and CSS and does not know anything about PHP, Python, Ruby and other languages. As such it may – for example – work well for HTML based templating syntaxes but will not lead to any results formatting the parts in such a file that are not HTML, Javascript or CSS.
Currently the following additional syntaxes are enabled:
HTML (EJS)
andHTML (ERB)
HTML (Jinja2)
, see Jinja2 Nova ExtensionHTML (Liquid)
,CSS (Liquid)
,SCSS (Liquid)
, see Liquid Nova Extension
Use at your own risk.
Known issues
- If some configuration options do not have an effect, try disabling the
preserve existing line-breaks
and check otherpreserve
options. - If some configuration options entered into text fields are not directly used, then this is due to a bug in Nova. You have to switch to another activated extension in the extension library (i.e. loose focus on the Beautify extension) before the values get updated. You can check which configuration options are being used by checking the extension console after formatting.
Screenshots
Changelog
Version 1.8
- Added config options for
indent empty lines
andmax. preserved line-breaks
(all) - Added config options for
operator position
(Javascript & JSON)
Version 1.7.3
- Updated JS-Beautify to 1.14.11
Version 1.7.2
- Updated JS-Beautify to 1.14.9
Version 1.7.1
- Updated JS-Beautify to 1.14.9
Version 1.7
- Updated JS-Beautify to 1.14.8
Version 1.6
- Added (experimental) support for
HTML (EJS)
andHTML (ERB)
- Added (experimental) support for
HTML (Jinja2)
, see Jinja2 Nova Extension - Added (experimental) support for
HTML (Liquid)
,CSS (Liquid)
,SCSS (Liquid)
, see Liquid Nova Extension
Version 1.5
- Added format on save option
- Updated JS-Beautify to 1.14.7
Version 1.4.1
- Automatic lowercasing of configuration option values (as expected by JS-Beautify)
- Extension console logs configuration options used for formatting
Version 1.4
- Added commands to format as specific syntax
- Removed
Format selection
- Automatically formats any selected text or the whole document if there was no selection
Version 1.3
- Added config options for
add spaces around combinators
(CSS, SCSS & LESS)
Version 1.2
- Added config options for
unformatted tags
,unformatted content
andextra lines before
(HTML & XML)
Version 1.1
- Line ending setting is inherited from the open document
- Main configuration options of JS-Beautify can be set globally
Version 1.0
- Initial release