The command Bundles → HTML → Tidy is a wrapper for the
tidy shell command included with Mac OS X.
To see the default settings run
tidy -show-config in a shell (terminal). TextMate will call
tidy with a few configuration options which can be seen by locating the Tidy TextMate command via the bundle editor, see Bundles → Bundle Editor.
The Tidy TextMate command is doing a little more than just calling
tidy. We enable XHTML mode only if you have set
TM_XHTML, we make the output use soft tabs if your settings indicate that, we do not include HTML boilerplate (doctype, html, and body tags) if you invoke the action with a selection, and similar.
If you want to alter how the default Tidy in TextMate works you have two options.
Edit the command. Advantage: should be straightforward. Disadvantage: if the default command is updated, TextMate will continue to use your customized version (see how to revert bundles).
HTML_TIDYenvironment variable to point at a configuration file and place your options in this file. In addition to leaving TextMate’s Tidy command pristine, it will allow you to set project-specific preferences for
tidy, which might be useful for example if you have different projects in which you want it to use different document types.
We should add an example of how to do #2
We may want to drop our default config options (in the TextMate Tidy command) if the
HTML_TIDY environment variable is set (so we do not eclipse user’s config options).