-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.ts
43 lines (38 loc) · 1.16 KB
/
index.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import type Hexo from "hexo";
declare let hexo: Hexo;
import { filter } from "./filter";
hexo.config.hexo_htmlnano = hexo.config.hexo_htmlnano || {};
hexo.config.hexo_htmlnano.htmlnanoOptions = Object.freeze(
Object.assign(
{
removeEmptyAttributes: false, // Disable the module "removeEmptyAttributes"
collapseWhitespace: "conservative", // Pass options to the module "collapseWhitespace"
},
hexo.config.hexo_htmlnano.htmlnanoOptions,
),
);
hexo.config.hexo_htmlnano.postHtmlOptions = Object.freeze(
Object.assign(
{
// sync: false, // https://github.com/posthtml/posthtml#usage
// lowerCaseTags: true, // https://github.com/posthtml/posthtml-parser#options
// quoteAllAttributes: false, // https://github.com/posthtml/posthtml-render#options
},
hexo.config.hexo_htmlnano.postHtmlOptions,
),
);
const options = Object.freeze(
Object.assign(
{
enable: true,
priority: 999,
exclude: [],
presetName: "safe",
},
hexo.config.hexo_htmlnano,
),
);
hexo.config.hexo_htmlnano = options;
if (options.enable) {
hexo.extend.filter.register("after_render:html", filter, options.priority);
}