-
Notifications
You must be signed in to change notification settings - Fork 6.6k
/
.eleventy.js
71 lines (60 loc) · 1.97 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
const syntaxHighlight = require("@11ty/eleventy-plugin-syntaxhighlight");
const eleventyNavigationPlugin = require("@11ty/eleventy-navigation");
const toBootstrapNav = require('eleventy-navigation-bootstrap')
const pluginTOC = require("eleventy-plugin-toc");
const markdownIt = require("markdown-it");
const markdownItAnchor = require("markdown-it-anchor");
const markdownItHighlightJS = require("markdown-it-highlightjs");
const readerBar = require("henry-reader-bar");
const readingTime = require("henry-reading-time");
const mdOptions = {
html: true,
breaks: true,
linkify: true,
typographer: true,
};
const mdAnchorOpts = {
permalink: true,
permalinkClass: "anchor-link",
permalinkSymbol: "",
level: [1, 2, 3, 4],
};
module.exports = function (eleventyConfig) {
eleventyConfig.setLibrary(
"md",
markdownIt(mdOptions)
.use(markdownItAnchor, mdAnchorOpts)
.use(markdownItHighlightJS)
);
eleventyConfig.addPlugin(eleventyNavigationPlugin);
eleventyConfig.addPlugin(readingTime);
eleventyConfig.addPlugin(readerBar);
eleventyConfig.addPlugin(syntaxHighlight);
eleventyConfig.addPlugin(pluginTOC, {
tags: ['h2', 'h3'],
ul: true
})
eleventyConfig.addPassthroughCopy("_src/styles");
eleventyConfig.addPassthroughCopy("_src/assets");
eleventyConfig.addNunjucksFilter('bootstrapNav', toBootstrapNav)
eleventyConfig.addLinter("Spelling check", function(content, inputPath, outputPath) {
let words = "lenght, .lenght, .rigth".split(",");
// Eleventy 1.0+: use this.inputPath and this.outputPath instead
if( inputPath.endsWith(".md") ) {
for( let word of words) {
let regexp = new RegExp("\\b(" + word + ")\\b", "gi");
if(content.match(regexp)) {
console.warn(`Spelling check (${inputPath}) Found: ${word}`);
}
}
}
});
return {
dir: {
includes: "/_src/layouts",
data: "/_src/data",
output: "_dist",
pathPrefix: "/Prep-Course-Stage/"
},
};
};