site/.eleventy.js
2024-07-08 00:17:58 -05:00

44 lines
1.2 KiB
JavaScript

const eleventyNavigationPlugin = require("@11ty/eleventy-navigation");
const markdownIt = require("markdown-it");
const markdownItFootnote = require("markdown-it-footnote");
const markdownItAnchor = require("markdown-it-anchor");
const { DateTime } = require("luxon");
const MARKDOWN_OPTIONS = {
html: true,
breaks: true,
linkify: true,
typographer: true,
};
const md = new markdownIt(MARKDOWN_OPTIONS)
.use(markdownItFootnote)
.use(markdownItAnchor);
module.exports = function (eleventyConfig) {
// Libraries
eleventyConfig.setLibrary("md", md);
// Plugins
eleventyConfig.addPlugin(eleventyNavigationPlugin);
// Filters
eleventyConfig.addFilter("formatDate", (dateObj, format) => {
return DateTime.fromJSDate(dateObj).toFormat(format);
});
// Passthrough copies
eleventyConfig.addPassthroughCopy({ "./src/res/css/**/*.css": "css" });
eleventyConfig.addPassthroughCopy({ "./src/res/font": "font" });
eleventyConfig.addPassthroughCopy({ "./src/res/img": "img" });
eleventyConfig.addPassthroughCopy({ "./src/res/*.txt": "." });
eleventyConfig.addWatchTarget("./src/res/css"); // Watch stylesheets
return {
dir: {
input: "src",
output: "_site",
},
};
};