const blogTools = require("eleventy-plugin-blog-tools"); const markdownIt = require("markdown-it"); const markdownItAttrs = require("markdown-it-attrs"); const markdownItAnchor = require("markdown-it-anchor"); const syntaxHighlight = require("@11ty/eleventy-plugin-syntaxhighlight"); const { DateTime } = require("luxon"); module.exports = function(eleventyConfig) { const mdOptions = { html: true, breaks: true, linkify: true, }; const markdownLib = markdownIt(mdOptions) .use(markdownItAttrs) .use(markdownItAnchor, { permalink: markdownItAnchor.permalink.linkInsideHeader({ // Change the symbol to a link icon, e.g., "🔗" symbol: '🔗', // Change this to whatever symbol you want class: 'anchor-link', // You can style this class with CSS ariaHidden: false, tabIndex: -1, before: '', // Leave empty to not add anything before the icon }) }) .disable("code"); eleventyConfig.addFilter("postDate", (dateObj) => { return DateTime.fromJSDate(dateObj).toLocaleString(DateTime.DATE_MED); }); eleventyConfig.setLibrary("md", markdownLib); eleventyConfig.setUseGitIgnore(false); eleventyConfig.addPassthroughCopy('./src/css'); eleventyConfig.addPassthroughCopy('./src/assets/'); eleventyConfig.addPassthroughCopy('./src/js/'); eleventyConfig.addWatchTarget('./src/css'); eleventyConfig.addWatchTarget('./src/js'); eleventyConfig.addWatchTarget('./src/assets/'); eleventyConfig.setDataDeepMerge(true); eleventyConfig.setTemplateFormats("html,njk,md"); eleventyConfig.addCollection('posts', function(collectionApi) { return collectionApi.getFilteredByGlob('src/blog/posts/**/*.md'); }); eleventyConfig.addPlugin(blogTools); eleventyConfig.addPlugin(syntaxHighlight); return { passthroughFileCopy: true, dir: { input: 'src', includes: '_includes', output: "_site" } }; }