[opt] image.parse_markdown
This commit is contained in:
parent
4195a103a6
commit
372a382bb0
|
@ -239,9 +239,9 @@ tag_plugins:
|
||||||
blobcat: https://gcore.jsdelivr.net/gh/norevi/waline-blobcatemojis@1.0/blobs/${name}.png
|
blobcat: https://gcore.jsdelivr.net/gh/norevi/waline-blobcatemojis@1.0/blobs/${name}.png
|
||||||
# {% image %}
|
# {% image %}
|
||||||
image:
|
image:
|
||||||
fancybox: # true, false
|
fancybox: false # true, false
|
||||||
replace_original: #把markdown格式的图片解析成图片标签
|
parse_markdown: true # 把 markdown 格式的图片解析成图片标签
|
||||||
enable: false
|
|
||||||
# {% timeline %}
|
# {% timeline %}
|
||||||
timeline:
|
timeline:
|
||||||
max-height: 80vh
|
max-height: 80vh
|
||||||
|
|
|
@ -3,13 +3,10 @@
|
||||||
hexo.extend.filter.register('after_render:html', require('./lib/img_lazyload').processSite);
|
hexo.extend.filter.register('after_render:html', require('./lib/img_lazyload').processSite);
|
||||||
hexo.extend.filter.register('after_render:html', require('./lib/img_onerror').processSite);
|
hexo.extend.filter.register('after_render:html', require('./lib/img_onerror').processSite);
|
||||||
|
|
||||||
function change_image(data){
|
function change_image(data) {
|
||||||
const cfg = this.theme.config.tag_plugins.image.replace_original;
|
if (this.theme.config.tag_plugins.image.parse_markdown) {
|
||||||
|
|
||||||
if (cfg.enable){
|
|
||||||
data.content = data.content.replace(/!\[([^\]]*)]\(([^(]+)\)/g, '{% image $2 $1 %}');
|
data.content = data.content.replace(/!\[([^\]]*)]\(([^(]+)\)/g, '{% image $2 $1 %}');
|
||||||
}
|
}
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue