Hi All,
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?
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?
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?
Thanks,
-Eric
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 :)
Thanks Allen, this is working for me with one small change. You can specify the tab size in a Tidy config file which I have done. But, the --tab-size was overriding the setting on my tidy config file. So, I have just deleted that part of your command and it is fully using my config file now. I deleted this: "--tab-size $TM_TAB_SIZE --indent- spaces $TM_TAB_SIZE".
This is great! I am gradually switching all my coding to TextMate as I get more comfortable with it and start to customize it to my needs. I'm using it for Ruby, HTML, and general text editing like Markdown. The next big thing I would like to crack is Java. I think that will be more difficult but I don't need TextMate to be Eclipse so I'm hopeful.
Thanks again.
-Eric
On Oct 18, 2005, at 5:51 PM, Allan Odgaard wrote:
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 :)
For new threads USE THIS: textmate@lists.macromates.com (threading gets destroyed and the universe will collapse if you don't) http://lists.macromates.com/mailman/listinfo/textmate