# HTMLBeautify v0.85 ## SublimeText (version 2 & 3) - (Inspired by fhtml.pl by John Watson) - by Ross A. Reyman - 20 February 2015 - url: [http://reyman.name/](http://reyman.name/) - e-mail: ross[at]reyman[dot]name --- A plugin for [Sublime Text ](http://sublimetext.com/), that formats (indents) HTML source code. It makes code easier for humans to read. --- ## Key Commands Reverted Back to Original Due to a conflict with other keymaps in Sublime Text, I am reverting the keymap back to the original setting: - Mac OS X: `Command-Option-Shift-F` - Windows: `Control-Alt-Shift-F` - Linux: `Control-Alt-Shift-F` (To change this, see instructions later in this README…) ## Notes - This script assumes an effort has been made by the user to expand tags to different lines. This script will **not** automatically expand minimized/compressed code—it will only try to “clean-up” code that needs to be re-indented - However, you can use multiple cursors ([Find All][1]) or use [Replace][2] on the beginning of a tag `<` to put every tag on a new line before applying beautify, which will help in this case. - Currently, this script chokes a bit with inline comments. - For example: `
{ "keys": ["super+alt+shift+f"], // create your own key command combination here! "command": "html_beautify", // command that executes html_beautify "context": [{ // these options ensure that the command is executed in the right files/context "key": "selector", "operator": "equal", "operand": "text.html,text.html.twig,text.twig,source.html,source.html.twig,source.twig" }] }For more details: [Sublime Text Unofficial Documentation: Key Bindings](http://sublime-text-unofficial-documentation.readthedocs.org/en/sublime-text-2/reference/key_bindings.html) ## Disclaimer This script has been tested for basic HTML coding situations, but your mileage may vary—use with caution if using this in a production environment. (Please report bugs or contribute corrections to the script!) Although the script does not remove or modify code directly (it only attempts to adjust indentation levels), be sure to test this script throughly to make sure it works as expected! The author is not responsible for any bugs that might be introduced to your HTML. :) [1]: https://www.sublimetext.com/docs/2/multiple_selection_with_the_keyboard.html [2]: http://sublime-text-unofficial-documentation.readthedocs.org/en/latest/search_and_replace/search_and_replace.html#replacing-text