[TxMt] Tidy questions

Allan Odgaard throw-away-1 at macromates.com
Tue Oct 18 22:51:29 UTC 2005


On 18/10/2005, at 18.05, Eric Knapp wrote:

> I'm using TextMate for lots of HTML these days. I like the built-in  
> Tidy command but it removes non-breaking spaces ( ). How do I  
> adjust this?

Turns out the -bare/-b option was responsible for this. I have  
changed the command to not add this option. While reading up on Tidy,  
I found a few other neat options, so I changed the command to:

"${TM_TIDY:-tidy}" -f /dev/null -iq -utf8 -asxhtml --tab-size  
$TM_TAB_SIZE --indent-spaces $TM_TAB_SIZE

Basically the “new” thing is that it uses the current tab size as the  
amount of spaces to indent, and it knows about the tab size as well  
(if e.g. the document contains tabs in a <pre> block, Tidy will  
convert these to spaces, using the tab size).

I was tempted to pipe the result through unexpand, to convert spaces  
to tabs, but then it “breaks” the <pre> blocks (i.e. by using tabs  
when one really wants to use spaces), so I refrained from doing that  
-- a better option is probably to enable soft tabs for HTML.

> Next, I have a nice Tidy config file that I use when running tidy  
> from the command line. Can I configure the tidy command to use my  
> config file?

 From the man page, it seems Tidy uses a HTML_TIDY variable for the  
config file.

So go to Preferences / Advanced (in TextMate), make a new entry with  
Name set to HTML_TIDY and value set to e.g. /Users/eric/.tidy_config

It needs to be an absolute path, i.e. you can't use ~/ or $HOME.

> Finally, in the Tidy command in the Bundle Editor is this comment:
>     # BEWARE. Errors are suppressed. Use Tidy Error Display first!
> Where is the Tidy Error Display command?

uhm… I sacked it… I've updated the comment :)





More information about the textmate mailing list