gil.ink/.eleventy.js

46 lines
1.1 KiB
JavaScript
Raw Permalink Normal View History

2025-02-06 21:51:23 -05:00
import eleventyNavigationPlugin from "@11ty/eleventy-navigation";
import markdownIt from "markdown-it";
import markdownItFootnote from "markdown-it-footnote";
import markdownItAnchor from "markdown-it-anchor";
2025-02-19 03:03:13 -05:00
import { DateTime } from "luxon";
2025-02-06 21:51:23 -05:00
2025-02-18 15:12:10 -05:00
export default function (eleventyConfig) {
const MARKDOWN_OPTIONS = {
html: true,
breaks: true,
linkify: true,
typographer: true,
};
let md = markdownIt(MARKDOWN_OPTIONS)
.use(markdownItFootnote)
.use(markdownItAnchor);
2025-02-06 21:51:23 -05:00
// Libraries
eleventyConfig.setLibrary("md", md);
// Plugins
eleventyConfig.addPlugin(eleventyNavigationPlugin);
2025-02-19 03:03:13 -05:00
// Filters
eleventyConfig.addFilter("formatDate", (dateObj) => {
return DateTime.fromJSDate(dateObj).toFormat('dd LLL yyyy, HH:mm ZZZZ');
});
2025-02-06 21:51:23 -05:00
// Passthrough copies
2025-02-18 15:12:10 -05:00
["src/assets"].forEach((path) => {
eleventyConfig.addPassthroughCopy(path);
});
2025-02-06 21:51:23 -05:00
eleventyConfig.addWatchTarget("./src/assets/css");
return {
dir: {
2025-02-19 03:03:13 -05:00
input: "src",
output: "public",
includes: "_includes",
layouts: "_layouts",
2025-02-06 21:51:23 -05:00
},
};
}