diff --git a/scripts/99_tags.js b/scripts/99_tags.js index 30de1b83..ace2c4dd 100644 --- a/scripts/99_tags.js +++ b/scripts/99_tags.js @@ -3,5 +3,26 @@ */ hexo.extend.tag.register('colorquote', function (args, content) { var type = args[0]; - return '
' + content + '
'; -}, {ends: true}); \ No newline at end of file + return '
' + hexo.render.renderSync({text: content, engine: 'markdown'}) + '
'; +}, {ends: true}); + +const rEscapeContent = /]*)>([\s\S]*?)<\/escape>/g; +const placeholder = '\uFFFD'; +const rPlaceholder = /(?:<|<)\!--\uFFFD(\d+)--(?:>|>)/g; +const cache = []; +function escapeContent(str) { + return ''; +} +hexo.extend.filter.register('before_post_render', function(data) { + data.content = data.content.replace(rEscapeContent, function(match, content) { + return escapeContent(content); + }); + return data; +}); + +hexo.extend.filter.register('after_post_render', function(data) { + data.content = data.content.replace(rPlaceholder, function() { + return cache[arguments[1]]; + }); + return data; +});