2021-02-19 23:33:19 +08:00
|
|
|
'use strict';
|
|
|
|
|
2021-03-04 22:30:56 +08:00
|
|
|
hexo.extend.filter.register('after_render:html', require('./lib/img_lazyload').processSite);
|
|
|
|
hexo.extend.filter.register('after_render:html', require('./lib/img_onerror').processSite);
|
2023-01-30 22:08:37 +08:00
|
|
|
|
2023-05-09 13:17:36 +08:00
|
|
|
function change_image(data) {
|
|
|
|
if (this.theme.config.tag_plugins.image.parse_markdown) {
|
2023-05-17 10:35:39 +08:00
|
|
|
data.content = data.content.replace(
|
|
|
|
/!\[(.*?)\]\((.*?)\s*(?:"(.*?)")?\)/g,
|
|
|
|
'{% image $2 $3 %}'
|
|
|
|
);
|
2023-01-30 22:08:37 +08:00
|
|
|
}
|
|
|
|
return data;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
hexo.extend.filter.register('before_post_render', change_image, 9);
|