Tidy has a wide range of configuration options that allow you to manipulate
how the output of tidy will look. In this case, you can use the 'show-body-only'
option to keep tidy from creating a full HTML document.
Setting options
<?php $tidy = new tidy_doc(); $tidy->parseFile("intro2_ex1.html", array("show-body-only" => true)); $tidy->cleanRepair();
echo $tidy; ?>
Result
<p>Hello, <b>This HTML</b><i>is all sorts of</i> messed up!</p>