libtidy documentation¶
libtidy¶
Python binding for the libtidy C library.
Overview¶
libtidy uses the underlying libtidy C shared library as specified in libtidy.cfg (included libtidy-X.X.* is the default), but there is also ability to specify it programmatically by one of the following ways:
import libtidy
libtidy.config(LIBTIDY="libtidy C shared library absolute path")
# or
libtidy.config(LIBTIDY=None) # included libtidy-X.X.* will be used
About original libtidy:¶
Borrowed from the original website:
libtidy Introduction
libtidy is the library version of HTML Tidy. In fact, Tidy is libtidy; the console application is a very simple C application that links against libtidy. It’s what powers Tidy, mod-tidy, and countless other applications that perform tidying.
Design factors
libtidy is Thread Safe and Re-entrant. Because there are many uses for HTML Tidy - from content validation, content scraping, conversion to XHTML - it was important to make libtidy run reasonably well within server applications as well as client side.
Requirements¶
- It is a fully independent package.All necessary things are installed during the normal installation process.
ATTENTION: currently works and tested only for Windows.
Installation¶
Prerequisites:
Python 3.10 or higher
with C libtidy 5.9.14 is a primary test environment.
pip and setuptools
To install run:
python -m pip install --upgrade libtidy
Development¶
Prerequisites:
Development is strictly based on tox. To install it run:
python -m pip install --upgrade tox
Visit Development page.
Installation from sources:
clone the sources:
git clone https://github.com/karpierz/libtidy.git libtidy
and run:
python -m pip install ./libtidy
or on development mode:
python -m pip install --editable ./libtidy
License¶
Copyright (c) 2024-2025 Adam KarpierzLicensed under the HTML Tidy LicensePlease refer to the accompanying LICENSE file.