hexo icon indicating copy to clipboard operation
hexo copied to clipboard

Proposal: introduces PostHTML into Hexo

Open SukkaW opened this issue 2 years ago • 3 comments

Since Hexo is a framework outputting HTML files. So we should introduce an HTML transformer into Hexo's core. PostHTML is a tool to transform HTML/XML. With PostHTML we can:

  • Migrate away from RegExp and manipulate PostHTML AST instead.
    • meta_generator: https://github.com/hexojs/hexo/blob/master/lib/plugins/filter/after_render/meta_generator.js
    • external_link: https://github.com/hexojs/hexo/blob/4.2.1/lib/plugins/filter/after_render/external_link.js
    • Injector plugin: https://github.com/hexojs/hexo/blob/master/lib/extend/injector.js
  • Enables possibility for more features that require manipulation of HTML (E.g. lazyload images. We can set the data-src attribute directly in the Hexo, and inject the lazyload.js directly to the output, without being limited by the themes)
  • Integrate htmlnano directly into Hexo.

SukkaW avatar Oct 13 '21 20:10 SukkaW

Reminds me of soupault, an SSG that can parse/manipulate HTML.

Integrate htmlnano directly into Hexo.

Do you mean posthtml itself instead? htmlnano is just a minifier like hexo-html-minifier, not everyone uses a minifier.

curbengh avatar Oct 24 '21 07:10 curbengh

Do you mean posthtml itself instead? htmlnano is just a minifier like hexo-html-minifier, not everyone uses a minifier.

Yeah, not everyone wants a minifier. But I want to make the minifier feature kinda a switch (set to true and boom! enabled) instead of a plugin.

SukkaW avatar Oct 25 '21 06:10 SukkaW

This issue has been automatically marked as stale because lack of recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar Dec 25 '21 00:12 github-actions[bot]