HTMLTidy is an open source utility for tidying up HTML. It is a command-line utility which is included in OS X. It is also used in my Plug-in for Coda. But Apple decided to include a quite old version (from 2006) – even in the current OS X 10.6 (Snow Leopard).
Since HTMLTidy has got some quite useful new features in the latest versions (like “preserve-entities“) and some bugfixes, this post explains how to install an updated version of HTMLTidy and how to use this with the Coda plug-in.
There are three different ways to accomplish this: You can try the binary I included here for download or use MacPorts or you can update by compiling your own version:
Method 1 – Downloading the binary (Use only if you’re afraid of the Terminal)
- Download this zip file » and unpack it.
- Copy the extracted file to your “Applications”-folder *
- Now the new version can be found in /Applications/tidy
Of course “/Applications” is not a very good location for a command line utility, but this is only for people who do not want to use the Terminal..
Method 2 – Using MacPorts
If you already use MacPorts that’s the most easy solution.
Open the terminal and enter this
sudo port install tidy
After MacPorts has downloaded and compiled the current version, you can find it in /opt/local/bin/tidy. (If you haven’t set up MacPorts to use another path)
Method 3 – Compiling a new version
If you know how to use the Terminal and navigate there, try this (in the Terminal):
cd /tmp cvs -d:pserver:firstname.lastname@example.org:/cvsroot/tidy login
Now you are asked for a password: Simply press return
cvs -z3 -d:pserver:email@example.com:/cvsroot/tidy co -P tidy cd tidy/ sh ./build/gnuauto/setup.sh ./configure --prefix=/usr/local/ make sudo make install
Here you’ve got to enter your OS X password once.
Now the updated version can be found in /usr/local/bin/tidy
Configuring the Coda Plugin
Depending on which of the three methods you used, the new location for tidy is /Applications/tidy or /opt/local/bin/tidy or /usr/local/bin/tidy.
Now in Coda open “Plug-ins” ->”PHP & Web Toolkit” -> “Preferences” and copy this location to the field “Tidy binary”. That’s it.