Merge branch 'master' of github.com:typecho/typecho

This commit is contained in:
joyqi 2017-10-27 16:42:29 +08:00
commit 8191c8fcea
2 changed files with 10 additions and 5 deletions

View File

@ -75,10 +75,15 @@ $(document).ready(function () {
'pre' : 'pre|code'
});
converter.hook('beforeParseInline', function (html) {
return html.replace(/^\s*<!\-\-\s*more\s*\-\->\s*$/, function () {
return converter.makeHolder('<!--more-->');
});
});
// 自动跟随
converter.hook('makeHtml', function (html) {
// convert all comment
html = html.replace(/&lt;!--(.+?)--&gt;/g, '<!--$1-->');
html = html.replace('<p><!--more--></p>', '<!--more-->');
if (html.indexOf('<!--more-->') > 0) {
var parts = html.split(/\s*<\!\-\-more\-\->\s*/),

View File

@ -28,8 +28,8 @@ class Markdown
});
$parser->hook('beforeParseInline', function ($html) use ($parser) {
return preg_replace_callback("/<!\-\-(.+?)\-\->/s", function ($matches) use ($parser) {
return $parser->makeHolder($matches[0]);
return preg_replace_callback("/^\s*<!\-\-\s*more\s*\-\->\s*$/s", function ($matches) use ($parser) {
return $parser->makeHolder('<!--more-->');
}, $html);
});
@ -43,7 +43,7 @@ class Markdown
));
}
return $parser->makeHtml($text);
return str_replace('<p><!--more--></p>', '<!--more-->', $parser->makeHtml($text));
}
/**