forked from marisademeglio/eleventypub
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.eleventy.js
41 lines (33 loc) · 1.01 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
// docs: https://www.11ty.io/docs/config/
const path = require('path');
const mime = require('mime');
const nunjucks = require('nunjucks');
const md = require("markdown-it");
const tocgen = require("./tocgen");
module.exports = function(eleventyConfig) {
// Copy the `img/` directory
eleventyConfig.addPassthroughCopy("src/resources");
let nunjucksEnv = new nunjucks.Environment(
new nunjucks.FileSystemLoader("src/_includes")
);
nunjucksEnv.addFilter('mediaType', function(str) {
return mime.getType(path.extname(str).slice(1));
});
nunjucksEnv.addFilter('makeTocItemsForPage', function(page) {
return tocgen.makeTocItemsForPage(page);
});
eleventyConfig.setLibrary("njk", nunjucksEnv);
let markdownIt = require("markdown-it")({
xhtmlOut: true,
html: true
})
.use(require('markdown-it-imsize'), {autofill: true});
eleventyConfig.setLibrary("md", markdownIt);
return {
passthroughFileCopy: true,
dir: {
input: "src",
output: "build/epub/EPUB"
}
};
};