add some useful html tag to markdown whitelist

This commit is contained in:
joyqi 2017-01-25 12:12:25 +08:00
parent b9dc6a61ad
commit f2ebf4b10a
3 changed files with 18 additions and 1 deletions

View File

@ -65,6 +65,15 @@ $(document).ready(function () {
span = '<span class="diff" />',
cache = {};
// 修正白名单
converter.commonWhiteList += '|img|cite|embed|iframe';
converter.specialWhiteList = $.extend(converter.specialWhiteList, {
'ol' : 'ol|li',
'ul' : 'ul|li',
'blockquote' : 'blockquote',
'pre' : 'pre|code'
});
// 自动跟随
converter.hook('makeHtml', function (html) {
// convert all comment

View File

@ -22,7 +22,7 @@ class HyperDown
* @var mixed
* @access private
*/
private $_specialWhiteList = array(
public $_specialWhiteList = array(
'table' => 'table|tbody|thead|tfoot|tr|td|th'
);

View File

@ -27,6 +27,14 @@ class Markdown
self::$parser = new HyperDown();
self::$parser->hook('afterParseCode', array('Markdown', 'transerCodeClass'));
self::$parser->hook('beforeParseInline', array('Markdown', 'transerComment'));
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);