The HTMLBundle.sugar offers most of the actions from the Textmate HTML.bundle that aren’t otherwise available. See the documentation below for the full list. It additionally includes an expanded collection of HTML snippets ported from Textmate for those used to typing things like
input and hitting tab to get a full input tag with tab stops.
Requires ShellActions.sugar! You must install ShellActions.sugar before the latest version of HTMLBundle.sugar will work.
If you have downloaded the HTMLBundle.sugar, simply double click the Sugar file to install it. If you have previously installed HTMLBundle.sugar, make sure to delete
~/Library/Application Support/Espresso/Sugars/HTMLBundle.sugar before trying to upgrade, as Espresso does not yet properly overwrite old copies of Sugars.
If you have git installed and wish to install the HTMLBundle.sugar that way, simply run these commands in the Terminal (first command is optional; only necessary to create the folder structure):
mkdir -p ~/Library/Application\ Support/Espresso/Sugars/ cd ~/Library/Application\ Support/Espresso/Sugars/ git clone git://github.com/onecrayon/HTMLBundle.sugar.git
You can then update the Sugar with a standard git pull:
cd ~/Library/Application\ Support/Espresso/Sugars/HTMLBundle.sugar/ git pull origin master
HTMLBundle.sugar contains the following actions:
Characters To Numeric Entities
Converts all characters in the selection (or word near the cursor, if no selection) into their numeric entity equivalent. Particularly useful for simple obfuscation of email addresses.
Decode Entities in Selection / Line
Converts HTML entities in the selected text (or the line the cursor is on if no selection) back to their character equivalents.
Encrypt Selection / Line (ROT 13)
URL Escape Selection / Line
Encodes the selection or line for use in a URL, including encoding spaces and other restricted characters.
URL Unescape Selection / Line
Identical to the previous action, but moving the other direction. Decodes special characters from their URL equivalents to standard characters.
Wrap In <?= … ?>
Wraps the selected text in PHP echo shortcode.
Strip HTML From Document / Selection
As you might expect, this strips all HTML from the selection or document using PHP’s
Validate Document (W3C)
Validates the active document using the W3C HTML validation service, and displays the results in a new window.
Update <img> Size
Invoke this while your cursor is in a line or selection with one or more
<img> elements, and the script will parse the path from the current location and try to update the img element’s width and height to reflect the actual image dimensions.
HTMLBundle.sugar also includes the following Textmate library of HTML snippets, most of which include default attributes and tab stops that make life easier. To use one, just type the name of the tag and hit tab:
- movie (QuickTime movie embed code)
- label (inserts label with accompanying input; a label without an input is available via Actions → HTML → Snippets → Label but has no tab completion associated with it)
- mailto (results in mailto link with default contents)
- refresh (meta refresh tag)
- opt (
<option>tag for populating a