generated from binyamin/eleventy-garden
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.eleventy.js
47 lines (40 loc) · 1.2 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
module.exports = function (eleventyConfig) {
const markdownIt = require("markdown-it");
const markdownItOptions = {
html: true,
linkify: true,
};
const mdWikilinksOptions = {
baseURL: "/notes/",
makeAllLinksAbsolute: true,
uriSuffix: "/",
linkPattern: /\[\[([\w\s/-]+)(\|([\w\s/]+))?\]\]/,
postProcessPageName: (pageName) => {
return pageName.trim().toLowerCase().replace(/\s/g, "-");
},
};
const md = markdownIt(markdownItOptions)
.use(require("markdown-it-footnote"))
.use(require("markdown-it-attrs"))
.use(require("@kwvanderlinde/markdown-it-wikilinks")(mdWikilinksOptions));
eleventyConfig.addFilter("markdownify", (string) => {
return md.render(string);
});
eleventyConfig.setLibrary("md", md);
eleventyConfig.addCollection("notes", function (collection) {
return collection.getFilteredByGlob(["notes/**/*.md", "index.md"]);
});
eleventyConfig.addPassthroughCopy("assets");
eleventyConfig.addPassthroughCopy("CNAME");
return {
useGitIgnore: false,
dir: {
input: "./",
output: "_site",
layouts: "layouts",
includes: "includes",
data: "_data",
},
passthroughFileCopy: true,
};
};