chore: consolidate filters
This commit is contained in:
parent
5c54e8d409
commit
36dbca3e3b
4 changed files with 8 additions and 10 deletions
|
@ -69,11 +69,6 @@ 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])
|
||||
})
|
||||
|
|
|
@ -3,10 +3,11 @@ 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
|
||||
|
@ -23,6 +24,9 @@ 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
|
||||
|
@ -112,7 +116,6 @@ 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
|
||||
|
|
4
package-lock.json
generated
4
package-lock.json
generated
|
@ -1,12 +1,12 @@
|
|||
{
|
||||
"name": "coryd.dev",
|
||||
"version": "18.6.4",
|
||||
"version": "18.6.5",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "coryd.dev",
|
||||
"version": "18.6.4",
|
||||
"version": "18.6.5",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@cdransf/api-text": "^1.4.0",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "coryd.dev",
|
||||
"version": "18.6.4",
|
||||
"version": "18.6.5",
|
||||
"description": "The source for my personal site. Built using 11ty.",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
|
|
Reference in a new issue