The PEAR::HTML_Common PHP package provides methods for html code display and
attributes handling.
* Methods to set, remove, update html attributes.
* Handles comments in HTML code.
* Handles layout, tabs, line endings for nicer HTML code.

Homepage:
https://pear.php.net/package/HTML_Common
