[TxMt] HTML Tidy

Eric Hsu erichsu at math.sfsu.edu
Thu Dec 2 15:28:41 UTC 2004

>Has this been brought up as a feature request? skEdit's (i'm using it
>while I wait for my Paypal deposit) tidy functionality is very well
>thought out. I'd like to see something similar in TM.

Here is my current kludge to get two HTML Tidy commands: one replaces 
a window with its Tidy-ed version, and another just produces a window 
with clickable error output.  Note that (bug? feature?) if HTML Tidy 
thinks there are errors in your document and you do a 'replace' then 
it will place the errors at the top of the document. You can fiddle 
with the Tidy flags to avoid that.

Also note that my version only runs on the last saved version and not 
the current one. That can also be tweaked...

Anyway, get HTML Tidy from http://tidy.sourceforge.net/ then install 
it someplace convenient. I put the command-line version at ~/bin/tidy

Report Errors Command:

Before: nothing
Command: ~/bin/tidy -e "$TM_FILEPATH"
Stdin: None
Stout: Sep window
Pattern: line (\d+) column (\d+) - (.*?)$
Format: $3
Line: 1

Replace Document with Tidy-ed Version Command:

Before: nothing
Command: ~/bin/tidy -bicq "$TM_FILEPATH"
Stdin: None
Stout: Replace doc

Works great for me!

- Eric
Eric Hsu, Assistant Professor of Mathematics
San Francisco State University
erichsu at math.sfsu.edu

More information about the textmate mailing list