hexojs / hexojs/hexo

Proposal: introduces PostHTML into Hexo

Open
#4,802 2 comments 4 reactions 0 assignees View on GitHub
proposal
Dominant language
TypeScript
Stars
41.8k
Forks
41
PR merge metrics
No merged PRs in 30d

Description

Since Hexo is a framework outputting HTML files. So we should introduce an HTML transformer into Hexo's core. [PostHTML](https://posthtml.org/) 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](https://github.com/posthtml/htmlnano) directly into Hexo.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.