Building, Installation & Configuration


Building and Installation

You need to know where the apxs tool is. apxs is part of the apache2 webserver and needed to compile mod_tidy.

$ tar xfz mod_tidy.tar.gz
$ cd mod_tidy
$ ./configure --with-apxs=/path/to/apxs
$ make
$ su root
# make install

That compiles mod_tidy and installs the module into the httpd module directory. Now you need to configure the webserver.


Add the following directives to your httpd.conf file or into a <VirtualHost> section. The path to depends on your apache installation.

LoadModule	tidy_module	/usr/local/httpd/modules/
AddOutputFilterByType	TIDY	text/html application/xhtml+xml

So the webserver loads mod_tidy and uses mod_tidy to filter HTML and XHTML output.

To set TidyLib options you use the TidyOption directive. An example mod_tidy configuration:

<IfModule tidy_module>
    # Run all HTML and XHTML through mod_tidy
    AddOutputFilterByType TIDY text/html application/xhtml+xml

    # TidyLib Options
    TidyOption accessibility-check 3
    TidyOption char-encoding utf8
    TidyOption enclose-text yes
    TidyOption indent auto
    TidyOption logical-emphasis yes
    TidyOption output-xhtml yes
    TidyOption wrap 0

For other TidyLib options refer to the TidyLib documentation