CustomizeTidy

HowTo.CustomizeTidy History

Show minor edits - Show changes to markup

November 11, 2008, at 21:38 UTC by Adrian Russell-Falla - corrected env var from TIDY_HTML to HTML_TIDY
Changed lines 37-38 from:

We may want to drop our default config options (in the TextMate Tidy command) if the `TIDY_HTML` environment variable is set (so we do not eclipse user’s config options).

to:

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).

June 09, 2008, at 15:38 UTC by Allan Odgaard - Add some page notes
Changed lines 30-38 from:

[use soft tabs]: UseSpacesInsteadOfTabs

to:

[use soft tabs]: UseSpacesInsteadOfTabs


  1. Page Notes

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 `TIDY_HTML` environment variable is set (so we do not eclipse user’s config options).

June 09, 2008, at 15:34 UTC by Allan Odgaard - Link to the tabs/spaces HowTo
Changed lines 9-10 from:

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.

to:

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.

Changed lines 29-30 from:

[enable XHTML mode]: ../HowTo/EnableXHTMLTags

to:

[enable XHTML mode]: EnableXHTMLTags [use soft tabs]: UseSpacesInsteadOfTabs

June 09, 2008, at 15:31 UTC by Allan Odgaard - Page about how to customize TextMate’s Tidy command
Added lines 1-30:

The command _Bundles → HTML → Tidy_ is a wrapper for the [`tidy`][tidy_1] shell command included with Mac OS X.

If you install another version of `tidy` you can either [update your search path][] to have the location of this version be found first, or set the `TM_TIDY` [environment variable][] to `/path/to/new/tidy`.

The `tidy` tool has an [extensive manual][] and a [quick references][] page where you will find a lot of settings which affect how `tidy` will process your HTML document.

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.

 1. 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][]).

 2. Set the `HTML_TIDY` [environment 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.

[tidy_1]: http://developer.apple.com/documentation/Darwin/Reference/ManPages/man1/tidy.1.html [extensive manual]: http://www.w3.org/People/Raggett/tidy/ [quick references]: http://tidy.sourceforge.net/docs/quickref.html

[environment variable]: http://manual.macromates.com/en/environment_variables

[update your search path]: http://manual.macromates.com/en/shell_commands#search_path

[how to revert bundles]: ../Troubleshooting/RevertToDefaultBundles

[project-specific preferences]: http://manual.macromates.com/en/environment_variables#project_dependent_variables

[enable XHTML mode]: ../HowTo/EnableXHTMLTags