From a369e660f5b387f2e68288518ac0130945b6affd Mon Sep 17 00:00:00 2001 From: Starfall Date: Thu, 17 Aug 2023 12:21:14 -0500 Subject: add excerpts to blog posts --- eleventy.config.js | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'eleventy.config.js') diff --git a/eleventy.config.js b/eleventy.config.js index dd31cc3..07da99d 100644 --- a/eleventy.config.js +++ b/eleventy.config.js @@ -1,7 +1,12 @@ const toml = require('@iarna/toml') +const markdown = require("markdown-it") const eleventyNavigation = require('@11ty/eleventy-navigation') const eleventyRss = require('@11ty/eleventy-plugin-rss') +const MD_OPTIONS = { + html: true, +}; + filter_local_date = function(date) { // yyyy-MM-dd return date.getFullYear() + '-' @@ -15,7 +20,10 @@ filter_rfc3339_datetime = function(date) { return date.toISOString().replace('T', ' '); } + module.exports = function(eleventyConfig) { + eleventyConfig.setLibrary('md', markdown(MD_OPTIONS)); + eleventyConfig.addPlugin(eleventyNavigation) eleventyConfig.addPlugin(eleventyRss) @@ -25,6 +33,9 @@ module.exports = function(eleventyConfig) { eleventyConfig.addFilter('local_date', filter_local_date) eleventyConfig.addFilter('rfc3339_datetime', filter_rfc3339_datetime) + eleventyConfig.addFilter('md', str => { + return markdown(MD_OPTIONS).render(str); + }) eleventyConfig.setFrontMatterParsingOptions({ engines: { -- cgit