Perfect HTML ?

Why do I find so many libraries dedicated to making HTML with code?

$html->input( .... )

Is HTML syntax so hard?

Why do I care, I’ve been working on a Macro post-processor for PHP (think taglibs) and have found that the builtin DOM functionality is too strict and every other library is trying let programmers ignore html.