2022-11-26 15:20:28 -08:00
|
|
|
const markdownIt = require('markdown-it');
|
|
|
|
|
const slugify = require('@sindresorhus/slugify');
|
|
|
|
|
const markdownItAnchor = require('markdown-it-anchor');
|
|
|
|
|
const markdownItObsidian = require('markdown-it-obsidian');
|
|
|
|
|
|
|
|
|
|
module.exports = function (eleventyConfig) {
|
|
|
|
|
eleventyConfig.addPassthroughCopy({ 'assets/css': 'css' });
|
|
|
|
|
eleventyConfig.addPassthroughCopy({ 'assets/fonts': 'fonts' });
|
|
|
|
|
eleventyConfig.addPassthroughCopy({ 'assets/images': 'images' });
|
|
|
|
|
eleventyConfig.addPassthroughCopy({
|
|
|
|
|
'node_modules/simpledotcss/simple.css': 'css/simple.css',
|
|
|
|
|
});
|
|
|
|
|
|
2022-11-28 18:30:34 -08:00
|
|
|
eleventyConfig.addFilter("makeRfc822Date", function (value) {
|
|
|
|
|
return new Date(value).toUTCString();
|
|
|
|
|
});
|
|
|
|
|
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,
|
|
|
|
|
})
|
|
|
|
|
);
|
|
|
|
|
eleventyConfig.setLibrary('md', markdownLibrary);
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
dir: {
|
|
|
|
|
input: 'src',
|
|
|
|
|
output: 'dist',
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
};
|