添加filter

This commit is contained in:
结发受长生
2019-04-18 22:51:44 +08:00
parent c8a3a7ba63
commit 29db0a7e4a
3 changed files with 65 additions and 20 deletions
+9
View File
@@ -0,0 +1,9 @@
hexo.extend.filter.register('before_post_render', function(data){
// data.raw 是原始的文件内容
// data.content 是处理过代码块语法高亮的内容
if(hexo.config.picture_cdn) {
data.content = data.content.replace(/\]\s*\((?=(?!http).*?\))/gi,
`](${hexo.config.picture_cdn}`)
}
return data;
});