fix: highlighting

This commit is contained in:
Cory Dransfeldt 2024-06-03 06:33:03 -07:00
parent 09cdd5dbdc
commit ae13df9813
No known key found for this signature in database
4 changed files with 14 additions and 12 deletions

View file

@ -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}`
}
}
}