-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
.eleventy.js
37 lines (34 loc) · 1.05 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
const syntaxHighlight = require('@11ty/eleventy-plugin-syntaxhighlight')
const striptags = require('striptags')
module.exports = function(eleventyConfig) {
eleventyConfig.setTemplateFormats("njk,md");
eleventyConfig.addPassthroughCopy({ "static/**/*": "." });
eleventyConfig.addPlugin(syntaxHighlight)
eleventyConfig.addNunjucksFilter('json', function(value) {
return JSON.stringify(value, null, 2)
})
eleventyConfig.addNunjucksFilter('markdown', function(value) {
try {
let markdown = require('markdown-it')();
return markdown.render(value);
} catch (e) {
return ''
}
})
eleventyConfig.addNunjucksFilter('strip', function(value) {
try {
return striptags(value, []);
} catch (e) {
return ''
}
})
return {
dir: {
input: 'pages',
output: 'dist',
// This value is relative to the input directory.
includes: '../src',
data: '../src/data',
}
}
}