const Nunjucks = require('nunjucks'); const nunjucksDate = require('nunjucks-date'); const syntaxHighlight = require('@11ty/eleventy-plugin-syntaxhighlight'); const markdownIt = require('markdown-it'); const markdownItClass = require('@toycode/markdown-it-class'); const markdownClassMapping = { // h1: ['hide'], h2: ['text-3xl', 'mt-6'], h3: ['text-2xl', 'mt-4'], h4: ['text-xl', 'mt-2'], h5: ['text-lg', 'mt-2'], h6: ['font-bold', 'mt-2'], blockquote: ['border-l-4', 'border-slate-900', 'px-4'], a: [ 'text-slate-200', 'underline', 'hover:text-white', 'hover:bg-rose-950', 'hover:outline', 'hover:outline-width-1', 'hover:outline-rose-950', 'active:text-white', 'active:bg-rose-900', 'active:outline', 'active:outline-width-1', 'active:outline-rose-900', 'focus:text-white', 'focus:bg-rose-900', 'focus:outline', 'focus:outline-width-1', 'focus:outline-rose-900' ], p: ['mb-2', 'text-slate-400', 'leading-7'], img: ['max-w-full', 'rounded-lg', 'max-h-600px'], ul: ['list-disc', 'ml-4'], }; module.exports = function(eleventyConfig) { let nunjucksEnvironment = new Nunjucks.Environment( new Nunjucks.FileSystemLoader("_includes") ); nunjucksDate.setDefaultFormat('MMMM Do, YYYY'); nunjucksDate.install(nunjucksEnvironment); eleventyConfig.addPlugin(syntaxHighlight); const md = markdownIt({ linkify: true, html: true }); md.use(markdownItClass, markdownClassMapping); eleventyConfig.setLibrary('md', md); eleventyConfig.addPassthroughCopy('img'); eleventyConfig.addPassthroughCopy('files'); eleventyConfig.addCollection( "pinned", collection => collection.getAllSorted().filter(item => item.data.pinned), ); eleventyConfig.setLibrary('njk', nunjucksEnvironment); };