HTML Tidy options in PHP context

<?php

// http://tidy.sourceforge.net/docs/quickref.html#add-xml-decl

$tidyOpts = array(
// 'bare' => TRUE, // strip MS HTML
// 'clean' => TRUE, // strip presentational tags
// 'css-prefix' => 'calc-', // CSS prefix for styles - default 'c'
// 'doctype' => 'omit', // DOCTYPE for output
// 'drop-empty-paras' => TRUE,
// 'drop-font-tags' => TRUE, // drop and with no corresponding style rules
// 'drop-proprietary-attributes' => TRUE, // drop things like MS data binding attributes
'wrap' => 0, // No wrapping initially
'word-2000' => TRUE,
'break-before-br' => TRUE, // should output a line break before each element.
'indent' => 'auto', // Indent the content of tags H1-H6, LI, TD, TD, or P
'indent-spaces' => 2,
);

$tidy = new tidy();
$tidy->parseFile('./myFile.html', $tidyOpts);
tidy_clean_repair($tidy);
echo $tidy;

Categories: