protected static function clean_html($html)
{
// Because PHP's DomDocument doesn't like HTML5 tags, ignore errors.
$dom = new \DOMDocument();
libxml_use_internal_errors(true);
$dom->loadHTML('<?xml encoding="utf-8" ?>' . $html);
libxml_clear_errors(true);
// Find the first-level nodes of the body tag.
$element = $dom->getElementsByTagName('body')->item(0)->childNodes->item(0);
$html = $dom->saveHTML($element);
return preg_replace('#<[^/>][^>]*></[^>]+>#', '', $html);
}