-
Notifications
You must be signed in to change notification settings - Fork 8
/
.eleventy.js
58 lines (51 loc) · 1.65 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
import { EleventyHtmlBasePlugin } from "@11ty/eleventy";
import syntaxHighlight from "@11ty/eleventy-plugin-syntaxhighlight";
import markdownItAnchor from "markdown-it-anchor";
import markdownItToc from "markdown-it-toc-done-right";
import markdownIt from "markdown-it";
export default function (eleventyConfig) {
eleventyConfig.setLibrary("md", markdownIt({
html: true,
linkify: true,
typographer: true
}));
eleventyConfig.amendLibrary("md", (mdLib) => {
return mdLib.use(markdownItAnchor, { // add anchors to headings
level: '2',
permalink: markdownItAnchor.permalink.ariaHidden({
class: 'anchor',
symbol: '#',
placement: 'before'
})
});
});
eleventyConfig.amendLibrary("md", (mdLib) => {
return mdLib.use(markdownItToc, { // make a TOC with ${toc}
level: '2',
listType: 'ul'
});
});
eleventyConfig.addCollection('turbo_handbook', collectionApi => {
return collectionApi.getFilteredByTag('turbo_handbook').sort((a, b) => {
return a.data.order - b.data.order;
});
})
eleventyConfig.addCollection('turbo_reference', collectionApi => {
return collectionApi.getFilteredByTag('turbo_reference').sort((a, b) => {
return a.data.order - b.data.order;
});
})
eleventyConfig.addPlugin(EleventyHtmlBasePlugin);
eleventyConfig.addPlugin(syntaxHighlight);
eleventyConfig.addPassthroughCopy({'_assets': 'assets'});
eleventyConfig.setDataDeepMerge(true);
return {
dir: {
layouts: "layouts",
includes: "_includes",
},
templateFormats: ['html', 'md', 'liquid', 'njk'],
htmlTemplateEngine: 'liquid',
pathPrefix: "/",
}
};