How-To Use Valid XHTML Tags in TextMate

Marketing

How-To Use Valid XHTML Tags in TextMate

Here’s a tip I just now found out about. In TextMate, the HTML bundle has a ton of available snippets. Unfortunately, they don’t automatically add the closing trailing slash for certain elements. For example, instead of inserting

<br/> or <input type="text"/>

TextMate inserts

<br> or <input type="text">

(Note the missing trailing slashes.)

You can change this behavior by going to

  1. TextMate Preferences → Advaned → Shell Variables
  2. Create a new variable called “TM_XHTML” with value “/” (no quotes)

Now TextMate will output valid XHTML when you use the HTML bundle.

Comments are closed on this post