Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs(api/filter): before_post_render & after_post_render process all files #1506

Closed
wants to merge 1 commit into from

Conversation

curbengh
Copy link
Contributor

@curbengh curbengh commented Aug 8, 2020

Closes #581

Check List

Please read and check followings before submitting a PR.

  • I want to publish my theme on Hexo official website.
    • I have read the theme publishing doc.
    • name is unique.
    • link URL is correct.
    • preview URL is correct.
    • preview URL web site is rendered correctly.
    • Add a screenshot to source/themes/screenshots.
    • Screenshot filename is same as value of name.
    • Screenshot size is 800 * 500.
    • Screenshot file format is png.
  • I want to publish my plugin on Hexo official website.
  • Others (Update, fix, translation, etc...)
    • Languages:
    • en English
    • ko Korean
    • pt-br Brazilian Portuguese
    • ru Russian
    • th Thai
    • zh-cn simplified Chinese
    • zh-tw traditional Chinese

});
```

This filter matches every files in the `source/` folder, it may be necessary to skip non-markdown files, unless those files are listed in [`config.skip_render`](/docs/configuration#Directory); `themes/<your-theme>/source/` folder is not processed by this filter.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Last time I checked, before_post_render only processes files under source/_posts directories.

Copy link
Contributor Author

@curbengh curbengh Aug 8, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did a check before this PR, both before_post_render and after_post_render processes everything in source/.


hexo.extend.filter.register('after_post_render', function(data){
  if (data.source.endsWith('.md') === false) console.log(data.content.substring(0, 50))
  return data;
});

I put a CSS file source/css/foo.css and it did show the file content, including in before_post_render filter.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@stevenjoezhang
Copy link
Member

Will be fixed in hexojs/hexo#5118

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Mention hexo will transform every file in source/ unless excluded with skip_render.
3 participants