2022-12-03 14:22:08 -08:00
|
|
|
const path = require("path");
|
2022-11-28 18:32:36 -08:00
|
|
|
const markdownIt = require("markdown-it");
|
|
|
|
|
const slugify = require("@sindresorhus/slugify");
|
|
|
|
|
const markdownItAnchor = require("markdown-it-anchor");
|
|
|
|
|
const markdownItObsidian = require("markdown-it-obsidian");
|
|
|
|
|
const markdownItAttrs = require("markdown-it-attrs");
|
2022-12-03 14:22:08 -08:00
|
|
|
const markdownItEleventyImg = require("markdown-it-eleventy-img");
|
2022-11-28 18:34:15 -08:00
|
|
|
const pluginRss = require("@11ty/eleventy-plugin-rss");
|
2022-11-26 15:20:28 -08:00
|
|
|
|
|
|
|
|
module.exports = function (eleventyConfig) {
|
2022-11-28 18:34:15 -08:00
|
|
|
eleventyConfig.addPlugin(pluginRss);
|
|
|
|
|
|
2022-11-28 18:34:47 -08:00
|
|
|
eleventyConfig.addPassthroughCopy({ "assets/css": "css" });
|
|
|
|
|
eleventyConfig.addPassthroughCopy({ "assets/fonts": "fonts" });
|
2022-12-03 14:22:08 -08:00
|
|
|
eleventyConfig.addPassthroughCopy({ "assets/images/*": "images" });
|
2022-11-29 20:17:10 -08:00
|
|
|
eleventyConfig.addPassthroughCopy({ "assets/favicon": "/" });
|
2022-11-26 15:20:28 -08:00
|
|
|
eleventyConfig.addPassthroughCopy({
|
2022-11-28 18:34:47 -08:00
|
|
|
"node_modules/simpledotcss/simple.css": "css/simple.css",
|
2022-11-26 15:20:28 -08:00
|
|
|
});
|
|
|
|
|
|
2022-11-29 19:56:23 -08:00
|
|
|
eleventyConfig.addFilter("stringToDate", function (value) {
|
|
|
|
|
return new Date(value);
|
2022-11-28 18:30:34 -08:00
|
|
|
});
|
|
|
|
|
eleventyConfig.addFilter("formatDatetimeForHumans", function (value) {
|
|
|
|
|
const dt = new Date(value);
|
|
|
|
|
const formattedDt = new Intl.DateTimeFormat("en", {
|
|
|
|
|
dateStyle: "medium",
|
|
|
|
|
timeStyle: "medium",
|
|
|
|
|
}).format(dt);
|
|
|
|
|
return formattedDt;
|
|
|
|
|
});
|
|
|
|
|
eleventyConfig.addFilter("formatDateForHumans", function (value) {
|
|
|
|
|
const dt = new Date(value);
|
|
|
|
|
const formattedDt = new Intl.DateTimeFormat("en", {
|
|
|
|
|
dateStyle: "medium",
|
|
|
|
|
}).format(dt);
|
|
|
|
|
return formattedDt;
|
|
|
|
|
});
|
|
|
|
|
|
2022-11-26 15:20:28 -08:00
|
|
|
const markdownLibrary = markdownIt()
|
|
|
|
|
.use(markdownItAnchor, { slugify })
|
|
|
|
|
.use(
|
|
|
|
|
markdownItObsidian({
|
|
|
|
|
slugifyOnPageLinks: slugify,
|
|
|
|
|
})
|
2022-11-28 18:32:36 -08:00
|
|
|
)
|
2022-12-03 14:22:08 -08:00
|
|
|
.use(markdownItAttrs)
|
|
|
|
|
.use(markdownItEleventyImg, {
|
|
|
|
|
imgOptions: {
|
|
|
|
|
outputDir: path.join("dist", "img"),
|
|
|
|
|
},
|
|
|
|
|
globalAttributes: {
|
|
|
|
|
loading: "lazy",
|
|
|
|
|
decoding: "async",
|
|
|
|
|
},
|
|
|
|
|
});
|
2022-11-28 18:32:36 -08:00
|
|
|
eleventyConfig.setLibrary("md", markdownLibrary);
|
2022-11-26 15:20:28 -08:00
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
dir: {
|
2022-11-28 18:34:47 -08:00
|
|
|
input: "src",
|
|
|
|
|
output: "dist",
|
2022-11-26 15:20:28 -08:00
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
};
|