-
Notifications
You must be signed in to change notification settings - Fork 0
/
plugins.ts
64 lines (58 loc) · 1.75 KB
/
plugins.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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
import lightningcss from "lume/plugins/lightningcss.ts";
import basePath from "lume/plugins/base_path.ts";
import metas from "lume/plugins/metas.ts";
import prism from "lume/plugins/prism.ts";
import { Options as SitemapOptions, sitemap } from "lume/plugins/sitemap.ts";
import { favicon, Options as FaviconOptions } from "lume/plugins/favicon.ts";
import {
googleFonts,
Options as GoogleFontsOptions,
} from "lume/plugins/google_fonts.ts";
import toc from "https://deno.land/x/[email protected]/toc.ts";
import { merge } from "lume/core/utils/object.ts";
import "lume/types.ts";
export interface Options {
sitemap?: Partial<SitemapOptions>;
favicon?: Partial<FaviconOptions>;
googleFonts?: Partial<GoogleFontsOptions>;
}
export const defaults: Options = {
favicon: {
input: "img/favicon.svg",
},
googleFonts: {
fonts: {
text:
"https://fonts.google.com/share?selection.family=Crimson+Pro:ital,wght@0,200..900;1,200..900",
},
cssFile: "styles.css",
},
};
/** Configure the site */
export default function (userOptions?: Options) {
const options = merge(defaults, userOptions);
return (site: Lume.Site) => {
site
.use(lightningcss())
.use(basePath())
.use(metas())
.use(sitemap(options.sitemap))
.use(favicon(options.favicon))
.use(googleFonts(options.googleFonts as GoogleFontsOptions))
.use(prism())
.use(toc({
level: 1,
}))
.copy("scripts")
.data("layout", "layouts/book.vto")
.copy("img")
.remoteFile(
"scripts/invoker.js",
"https://cdn.jsdelivr.net/npm/[email protected]",
);
site.hooks.markdownIt((md) => {
md.options.linkify = true;
md.options.typographer = true;
});
};
}