-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.eleventy.js
99 lines (89 loc) · 3.25 KB
/
.eleventy.js
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
import markdownItAnchor from "markdown-it-anchor";
import markdownItFootnote from 'markdown-it-footnote';
import {getHighlighter} from 'shiki';
import pluginRss from "@11ty/eleventy-plugin-rss";
import pluginSyntaxHighlight from "@11ty/eleventy-plugin-syntaxhighlight";
import pluginBundle from "@11ty/eleventy-plugin-bundle";
import pluginNavigation from "@11ty/eleventy-navigation";
import pluginTOC from "eleventy-plugin-toc";
import inclusiveLangPlugin from "@11ty/eleventy-plugin-inclusive-language";
import { EleventyHtmlBasePlugin } from "@11ty/eleventy";
import pluginImages from "./eleventy.config.images.js";
export default async function(eleventyConfig) {
// Output directory: _site
// Official plugins
eleventyConfig.addPlugin(pluginRss);
eleventyConfig.addPlugin(pluginNavigation);
eleventyConfig.addPlugin(EleventyHtmlBasePlugin);
eleventyConfig.addPlugin(pluginBundle,);
eleventyConfig.addPlugin(inclusiveLangPlugin);
eleventyConfig.addPlugin(pluginSyntaxHighlight, {
preAttributes: { tabindex: 0 }
});
// App plugins
eleventyConfig.addPlugin(pluginImages);
// Keeps the same directory structure.
eleventyConfig.addPassthroughCopy({
"src/css/": "css",
"src/blog/video/": "video",
"./node_modules/prismjs/themes/prism-okaidia.css": "/css/prism-okaidia.css"
});
eleventyConfig.addPassthroughCopy("src/font");
eleventyConfig.addPassthroughCopy("src/img/favicon.ico");
eleventyConfig.addPassthroughCopy("src/img/me.jpg");
eleventyConfig.on("eleventy.before", async () => {
const highlighter = await getHighlighter({
themes: ["material-theme-palenight"],
langs:["shell", "csharp", "python", "javascript", "java", "xml", "json"]
});
eleventyConfig.amendLibrary("md", (mdLib) =>
mdLib.set({
highlight: (code, lang) => highlighter.codeToHtml(code, {
lang: lang,
theme: "material-theme-palenight"
}),
})
);
});
eleventyConfig.amendLibrary("md", mdLib => {
mdLib
.use(markdownItAnchor, {
permalink: markdownItAnchor.permalink.ariaHidden({
placement: "after",
class: "header-anchor",
symbol: "#",
ariaHidden: false,
}),
level: [1,2,3,4],
slugify: eleventyConfig.getFilter("slugify")
})
.use(markdownItFootnote);
});
eleventyConfig.addPlugin(pluginTOC, {
ul: true
})
// Watch content images for the image pipeline.
eleventyConfig.addWatchTarget("blog/**/*.{svg,webp,png,jpeg}");
eleventyConfig.setFrontMatterParsingOptions({
excerpt: true,
// Optional, default is "---"
excerpt_separator: "<!-- excerpt -->",
});
return {
templateFormats: [
"md",
"njk",
"html",
"liquid"
],
markdownTemplateEngine: "liquid",
htmlTemplateEngine: "liquid",
dir: {
input: "src",
includes: "_includes",
data: "_data",
output: "_site"
},
pathPrefix: "/"
}
}