function HtmlToMarkdown($Html, $FormatHtml = False) { if (!class_exists('HTML_Parser', False)) { define('HTML2MD_HEADER_STYLE', 'ATX'); define('HTML2MD_SUPPRESS_ERRORS', True); define('HTML2MD_NEWLINE', "\n"); require_once USEFULFUNCTIONS_VENDORS . '/html2markdown.php'; } if ($FormatHtml) { $HtmlFormatter = Gdn::Factory('HtmlFormatter'); if ($HtmlFormatter) { $Html = $HtmlFormatter->Format($Html); } } $HtmlParser = new HTML_Parser($Html); $Result = $HtmlParser->get_markdown(); return $Result; }
function html2markdown($html) { $parser = new HTML_Parser($html); return $parser->get_markdown(); }