2019-05-20 20:41:39 +02:00
|
|
|
const pluginSyntaxHighlight = require("@11ty/eleventy-plugin-syntaxhighlight");
|
|
|
|
const inclusiveLangPlugin = require("@11ty/eleventy-plugin-inclusive-language");
|
|
|
|
|
|
|
|
module.exports = function(eleventyConfig) {
|
|
|
|
eleventyConfig.addPlugin(pluginSyntaxHighlight);
|
|
|
|
eleventyConfig.addPlugin(inclusiveLangPlugin);
|
|
|
|
|
|
|
|
let markdownIt = require("markdown-it");
|
|
|
|
let markdownItAnchor = require("markdown-it-anchor");
|
|
|
|
let markdownItReplaceLink = require("markdown-it-replace-link");
|
|
|
|
|
|
|
|
let markdownItOptions = {
|
|
|
|
html: true,
|
|
|
|
breaks: false,
|
|
|
|
linkify: true,
|
|
|
|
// Replace links to .md files with links to directories. This allows unparsed Markdown links
|
2019-05-26 06:55:28 +02:00
|
|
|
// to work on GitHub, while rendered links elsewhere also work.
|
2019-05-20 20:41:39 +02:00
|
|
|
replaceLink: function (link, env) {
|
2019-05-26 06:55:28 +02:00
|
|
|
return link.replace(/\.md$/, '/');
|
2019-05-20 20:41:39 +02:00
|
|
|
}
|
|
|
|
};
|
|
|
|
let markdownItAnchorOptions = {
|
|
|
|
permalink: true,
|
|
|
|
permalinkClass: "direct-link"
|
|
|
|
};
|
|
|
|
|
|
|
|
eleventyConfig.setLibrary(
|
|
|
|
"md",
|
|
|
|
markdownIt(markdownItOptions)
|
|
|
|
.use(markdownItAnchor, markdownItAnchorOptions)
|
|
|
|
.use(markdownItReplaceLink)
|
|
|
|
);
|
|
|
|
|
|
|
|
return {
|
|
|
|
templateFormats: [
|
|
|
|
"md",
|
|
|
|
"txt"
|
|
|
|
]
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|