diff --git a/.eleventy.js b/.eleventy.js index c0c768c4..3317f495 100644 --- a/.eleventy.js +++ b/.eleventy.js @@ -69,6 +69,11 @@ export default async function (eleventyConfig) { eleventyConfig.setLibrary('md', md) // filters + eleventyConfig.addLiquidFilter('markdown', (content) => { + if (!content) return + return md.render(content) + }) + Object.keys(filters).forEach((filterName) => { eleventyConfig.addLiquidFilter(filterName, filters[filterName]) }) diff --git a/config/filters/index.js b/config/filters/index.js index c4471fbc..addd30b2 100644 --- a/config/filters/index.js +++ b/config/filters/index.js @@ -3,11 +3,10 @@ import { URL } from 'url' import slugify from 'slugify' import markdownIt from 'markdown-it' import sanitizeHtml from 'sanitize-html'; + import { shuffleArray, sanitizeMediaString } from '../utilities/index.js' const BASE_URL = 'https://coryd.dev' -const md = markdownIt({ html: true, linkify: true }) - export default { // general @@ -24,9 +23,6 @@ export default { formatNumber: (number) => number.toLocaleString('en-US'), shuffleArray, - // markdown - markdown: (content) => md.render(content), - // navigation isLinkActive: (category, page) => { const normalizedPage = page.includes('.html') ? page.replace('.html', '/') : page @@ -116,6 +112,7 @@ export default { entries.forEach((entry) => { const dateKey = Object.keys(entry).find((key) => key.includes('date')) const date = new Date(entry[dateKey]) + const md = markdownIt({ html: true, linkify: true }) let excerpt = '' let url = '' let title = entry.title @@ -242,4 +239,4 @@ export default { return `${allButLast} and ${last}` } -} +} \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 537cd915..50c5e86b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "coryd.dev", - "version": "18.6.8", + "version": "18.6.9", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "coryd.dev", - "version": "18.6.8", + "version": "18.6.9", "license": "MIT", "dependencies": { "@cdransf/api-text": "^1.4.0", @@ -829,9 +829,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001626", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001626.tgz", - "integrity": "sha512-JRW7kAH8PFJzoPCJhLSHgDgKg5348hsQ68aqb+slnzuB5QFERv846oA/mRChmlLAOdEDeOkRn3ynb1gSFnjt3w==", + "version": "1.0.30001627", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001627.tgz", + "integrity": "sha512-4zgNiB8nTyV/tHhwZrFs88ryjls/lHiqFhrxCW4qSTeuRByBVnPYpDInchOIySWknznucaf31Z4KYqjfbrecVw==", "dev": true, "funding": [ { diff --git a/package.json b/package.json index 0f480e5a..5546572f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "coryd.dev", - "version": "18.6.8", + "version": "18.6.9", "description": "The source for my personal site. Built using 11ty.", "type": "module", "scripts": {