forked from TypeStrong/typedoc-site
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.eleventy.js
57 lines (46 loc) · 1.58 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
// @ts-check
const fs = require("fs");
const markdownIt = require("markdown-it");
const markdownItAnchor = require("markdown-it-anchor");
const eleventySass = require("eleventy-sass");
const syntaxHighlight = require("@11ty/eleventy-plugin-syntaxhighlight");
const { join } = require("path");
/** @param {import("@11ty/eleventy/src/UserConfig")} el */
module.exports = function (el) {
el.setUseGitIgnore(false);
// el.addPassthroughCopy("css");
el.addPassthroughCopy("scripts");
el.addPassthroughCopy("images");
el.addPassthroughCopy("CNAME");
el.addPlugin(syntaxHighlight);
el.addPlugin(eleventySass);
el.setLibrary(
"md",
markdownIt({ html: true }).use(/** @type {*} */ (markdownItAnchor))
);
el.addCollection("sorted_guides", function (collection) {
const items = collection.getFilteredByTag("guide");
items.sort((a, b) => a.data.menuOrder - b.data.menuOrder);
return items;
});
el.addCollection("alpha_tags", function (collection) {
const items = collection.getFilteredByTag("tag");
items.sort((a, b) =>
a.data.title
.replace(/[{}]/g, "")
.localeCompare(b.data.title.replace(/[{}]/g, ""))
);
return items;
});
el.addShortcode("typedocPlugins", () =>
fs.readFileSync(join(__dirname, "_includes/plugin_content.txt"))
);
el.addShortcode("typedocThemes", () =>
fs.readFileSync(join(__dirname, "_includes/theme_content.txt"))
);
return {
dir: {
layouts: "_layouts",
},
};
};