-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy path.eleventy.js
More file actions
57 lines (49 loc) · 1.74 KB
/
Copy path.eleventy.js
File metadata and controls
57 lines (49 loc) · 1.74 KB
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
module.exports = function (eleventyConfig)
{
const markdownIt = require('markdown-it');
const markdownItOptions = {
html: true,
linkify: true
};
const md = markdownIt(markdownItOptions)
.use(require('markdown-it-footnote'))
.use(require('markdown-it-attrs'))
.use(require('markdown-it-bracketed-spans'))
.use(function (md)
{
// Recognize Mediawiki links ([[text]])
md.linkify.add("[[", {
validate: /^\s?([^\[\]\|\n\r]+)(\|[^\[\]\|\n\r]+)?\s?\]\]/,
normalize: match =>
{
const parts = match.raw.slice(2, -2).split("|");
parts[0] = parts[0].replace(/.(md|markdown)\s?$/i, "");
match.text = (parts[1] || parts[0]).trim();
match.url = `/notes/${parts[0].trim()}/`;
}
});
});
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({ "node_modules/rough-notation/lib/rough-notation.iife.js": "js/rough-notation.iife.js" });
eleventyConfig.addPassthroughCopy({ "src/rough-notation-config.js": "js/rough-notation.config.js" });
eleventyConfig.addPassthroughCopy('src/assets');
return {
useGitIgnore: false,
dir: {
input: "src",
output: "_site",
layouts: "layouts",
includes: "includes",
data: "_data"
},
passthroughFileCopy: true
};
};