hook('afterParseCode', array('Markdown', 'transerCodeClass')); self::$parser->hook('beforeParseInline', array('Markdown', 'transerComment')); self::$parser->enableHtml(true); self::$parser->_commonWhiteList .= '|img|cite|embed|iframe'; self::$parser->_specialWhiteList = array_merge(self::$parser->_specialWhiteList, array( 'ol' => 'ol|li', 'ul' => 'ul|li', 'blockquote' => 'blockquote', 'pre' => 'pre|code' )); } return self::$parser->makeHtml($text); } /** * transerCodeClass * * @param string $html * @return string */ public static function transerCodeClass($html) { return preg_replace("//i", "", $html); } /** * @param $html * @return mixed */ public static function transerComment($html) { return preg_replace_callback("//s", array('Markdown', 'transerCommentCallback'), $html); } /** * @param $matches * @return string */ public static function transerCommentCallback($matches) { return self::$parser->makeHolder($matches[0]); } }