-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheleventy.config.cjs
73 lines (63 loc) · 2.26 KB
/
eleventy.config.cjs
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
const { EleventyHtmlBasePlugin } = require("@11ty/eleventy");
const eleventyNavigationPlugin = require("@11ty/eleventy-navigation");
const site = require('./src/_data/site.js');
const markdownIt = require("markdown-it");
const markdownItPrism = require('markdown-it-prism');
const markdownItAttrs = require('markdown-it-attrs');
const markdownItContainer = require('markdown-it-container');
const markdownItDefList = require('markdown-it-deflist');
module.exports = function(eleventyConfig) {
eleventyConfig.addWatchTarget('./tailwind.config.js')
eleventyConfig.addWatchTarget('./src/css/tailwind.css')
eleventyConfig.addPassthroughCopy("./src/**/*.{jpg,png,gif,svg,ico}");
eleventyConfig.addPassthroughCopy({ "./node_modules/flowbite/dist/*.js": "./js/" });
eleventyConfig.addPassthroughCopy({ "./node_modules/prismjs/themes/*.css": "./css/prismjs/" });
eleventyConfig.addPassthroughCopy("./src/about/slide/*.pdf");
eleventyConfig.addPlugin(EleventyHtmlBasePlugin);
eleventyConfig.addPlugin(eleventyNavigationPlugin);
let options = {
html: true,
breaks: false,
linkify: true
};
eleventyConfig.setLibrary("md", markdownIt(options));
eleventyConfig.amendLibrary("md", mdLib =>
mdLib
.use(markdownItAttrs)
.use(markdownItDefList)
.use(markdownItPrism)
.use(markdownItContainer, 'note', {
render: function (tokens, idx) {
var m = tokens[idx].info.trim().match(/^note\s+(.*)$/);
if (tokens[idx].nesting === 1) {
// opening tag
return `<section class="callout callout-${mdLib.utils.escapeHtml(m[1])}">`;
} else {
// closing tag
return '</section>';
}
}
})
);
eleventyConfig.addShortcode("proc", function(processorName) {
return `<a href="/docs/processors/#${processorName.replace(/m:/g, '')}"><code>${processorName}</code></a>`;
});
eleventyConfig.setLiquidOptions({
jsTruthy: true,
dynamicPartials: false,
strictFilters: false, // renamed from `strict_filters` in Eleventy 1.0
});
eleventyConfig.addFilter("absoluteUrl", function (url) {
try {
return new URL(site.prefix + url, site.baseUrl).href;
} catch (err) {
console.error(err);
return url;
}
});
return {
dir: {
input: "src",
}
};
};