hexo-theme-stellar/scripts/filters/index.js

18 lines
519 B
JavaScript

'use strict';
hexo.extend.filter.register('after_render:html', require('./lib/img_lazyload').processSite);
hexo.extend.filter.register('after_render:html', require('./lib/img_onerror').processSite);
function change_image(data) {
if (this.theme.config.tag_plugins.image.parse_markdown) {
data.content = data.content.replace(
/!\[(.*?)\]\((.*?)\s*(?:"(.*?)")?\)/g,
'{% image $2 $3 %}'
);
}
return data;
}
hexo.extend.filter.register('before_post_render', change_image, 9);