µTidylib

TidyLib Python wrapper

See the project page and the downloads page.

Also: API documentation.


10-Second Tutorial

>>> import tidy
>>> options = dict(output_xhtml=1, 
...                add_xml_decl=1, 
...                indent=1, 
...                tidy_mark=0)
>>> print tidy.parseString('<Html>Hello Tidy!', **options)
<?xml version="1.0" encoding="us-ascii"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <title></title>
  </head>
  <body>
    Hello Tidy!
  </body>
</html>

See the Tidy Options Reference for other options you can use.


Alternatives

mxTidy is an interface against Tidy "classic". Now somewhat out-of-date.

BerliOS Developer Logo