diff --git a/.eleventy.js b/.eleventy.js index 8bc7cfb..65d3262 100644 --- a/.eleventy.js +++ b/.eleventy.js @@ -8,6 +8,7 @@ const markdownItEleventyImg = require("markdown-it-eleventy-img"); const pluginRss = require("@11ty/eleventy-plugin-rss"); const embedYouTube = require("eleventy-plugin-youtube-embed"); const sanitizeHtml = require("sanitize-html"); +const syntaxHighlight = require("@11ty/eleventy-plugin-syntaxhighlight"); const metadata = require("./src/_data/metadata.json"); const sanitize = (html) => { @@ -20,16 +21,16 @@ const sanitize = (html) => { module.exports = function(eleventyConfig) { eleventyConfig.addPlugin(embedYouTube); eleventyConfig.addPlugin(pluginRss); + eleventyConfig.addPlugin(syntaxHighlight); - eleventyConfig.addPassthroughCopy({ "assets/css": "css" }); - eleventyConfig.addPassthroughCopy({ "assets/fonts": "fonts" }); - eleventyConfig.addPassthroughCopy({ "assets/images/*": "images" }); - eleventyConfig.addPassthroughCopy({ "assets/favicon": "/" }); + eleventyConfig.addPassthroughCopy("css"); + eleventyConfig.addPassthroughCopy("fonts"); + eleventyConfig.addPassthroughCopy("images/**/*.{gif,png,jpg,jpeg}"); + eleventyConfig.addPassthroughCopy({ "favicon": "/" }); eleventyConfig.addPassthroughCopy({ "node_modules/simpledotcss/simple.css": "css/simple.css", }); eleventyConfig.addPassthroughCopy({ "src/robots.txt": "robots.txt" }); - eleventyConfig.addPassthroughCopy({ "assets/images/about/devon.lol-button-03.gif": "images/devon.lol-button-03.gif" }); eleventyConfig.addFilter("buildPageTitle", function(title) { if (this.page.url === '/') { @@ -109,6 +110,17 @@ module.exports = function(eleventyConfig) { return sortedMentions; }); + eleventyConfig.addTransform('includePrismTheme', function(content, outputPath) { + // Automatically inject the Prism theme CSS, but only in HTML files that need it. + if (outputPath.endsWith('.html') && content.includes('