Skip to content

Commit

Permalink
Update post.js
Browse files Browse the repository at this point in the history
  • Loading branch information
stevenjoezhang committed Nov 29, 2022
1 parent 15dc70b commit 64fa502
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions lib/hexo/post.js
Expand Up @@ -376,13 +376,7 @@ class Post {
return Promise.reject(new Error('No input file or string!')).asCallback(callback);
}

// disable Nunjucks when the renderer specify that.
let disableNunjucks = ext && ctx.render.renderer.get(ext) && !!ctx.render.renderer.get(ext).disableNunjucks;

// front-matter overrides renderer's option
if (typeof data.disableNunjucks === 'boolean') disableNunjucks = data.disableNunjucks;

const cacheObj = new PostRenderEscape();
// Files like js and css are also processed by this function, but they do not require preprocessing like markdown
// data.source does not exist when tag plugins call the markdown renderer
const isPost = !data.source || ['html', 'htm'].includes(ctx.render.getOutput(data.source));

Expand All @@ -403,6 +397,14 @@ class Post {
}).asCallback(callback);
}

// disable Nunjucks when the renderer specify that.
let disableNunjucks = ext && ctx.render.renderer.get(ext) && !!ctx.render.renderer.get(ext).disableNunjucks;

// front-matter overrides renderer's option
if (typeof data.disableNunjucks === 'boolean') disableNunjucks = data.disableNunjucks;

const cacheObj = new PostRenderEscape();

return promise.then(content => {
data.content = content;
// Run "before_post_render" filters
Expand Down

0 comments on commit 64fa502

Please sign in to comment.