On Ubuntu 14.04 LTS (Trusty Tahr), tidy
is very old:
$ tidy --version
HTML Tidy for Linux released on 25 March 2009
$
What's the easiest way to get tidy-html5 installed?
Have I somehow overlooked the package for it?
On Ubuntu 14.04 LTS (Trusty Tahr), tidy
is very old:
$ tidy --version
HTML Tidy for Linux released on 25 March 2009
$
What's the easiest way to get tidy-html5 installed?
Have I somehow overlooked the package for it?
You can install the latest html-tidy from source using the instruction given on its github page.
But the easiest way to install the latest version of html-tidy5 would be downloading the latest binary from this page http://binaries.html-tidy.org/
If you're using 64bit Ubuntu, you'd do basically these commands
wget https://github.com/htacg/tidy-html5/releases/download/5.4.0/tidy-5.4.0-64bit.deb
sudo dpkg -i tidy-5.4.0-64bit.deb
It should be installed fine.
Method from official documentation.
If you need the latest CLI version, run in terminal:
$ sudo apt-get install xsltproc
$ git clone https://github.com/htacg/tidy-html5.git
$ cd tidy-html5
$ cd build/cmake
$ cmake ../.. -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIB:BOOL=OFF
$ make
$ sudo make install
This answer is relevant for April 2018. In the future, the data of this answer may be obsolete.
Else you need custom HTML Tidy things, you can need another options. Some citations of HTML Tidy contributor:
If you are just going to use the console app
tidy
, which by default is linked with the static librarylibtidys.a
, then not building and installing the shared library,libtidy.so
, that is-DBUILD_SHARED_LIB:BOOL=OFF
, is fine, but this is unusual in unix/linux…There are even some in the unix/linux community that prefer to build the console app tidy linking only with the shared library. See the cmake
-DTIDY_CONSOLE_SHARED:BOOL=ON
option, and see issue #326…And that also means to try to be consistent with the install location, like using
-DCMAKE_INSTALL_PREFIX[:PATH]=/usr
, but as stated in most cases the cmake default is also fine… and usually does not represent a problem…
Follow the instructions at the GitHub page. For the prerequisites, I needed to:
sudo apt-get install -y cmake xsltproc
Here's what I did to move from the current apt-get install tidy
to the latest version.
Find the URL of the latest version to download at: http://binaries.html-tidy.org.
Try the linux 64-bit DEB
first if you're not sure which to pick.
Download it:
wget <LATEST URL>
Remove unneeded tidy-lib
package. tidy-lib
is included in the .deb
you just downloaded.
sudo apt-get -y autoremove tidy
Install the .deb
you just downloaded:
sudo dpkg -i tidy-5.2.0-64bit.deb
Clean up:
rm tidy-*.deb
Thanks to @Anwar for pointing me in this direction.
I needed to do hash -d tidy
to get bash to run the new version from /usr/local
after I installed from source. You also may need to do this if you chose to keep the previous package of tidy
.
dpkg: error processing archive tidy-5.2.0-64bit.deb (--install):
trying to overwrite '/usr/lib/libtidy.so', which is also in package libtidy-0.99-0 20091223cvs-1.2ubuntu1.1
– Tom Hale
Sep 18 '16 at 07:13
overwrite '/usr/lib/libtidy.so'
and shows where to get the latest version.
– Tom Hale
Sep 18 '16 at 07:28
On the latest Ubuntus (Zesty, 17.04, and Artful, 17.10), it is updated to version 5.2.
There is a backports ppa for Trusty (14.04) and Xenial (16.04): ppa:jonathonf/backports
You could also use the nodejs package html-validator-cli
as a workaround
sudo -H npm install -g html-validator-cli
html-validator --filename=path/to/file
but it needs an internet connection.