refactor: update and theme configuration

This commit is contained in:
radishzzz 2025-01-17 02:50:53 +00:00
parent 7659bbd1e2
commit 63aa495d8b
19 changed files with 299 additions and 310 deletions

View file

@ -0,0 +1,15 @@
// biome-ignore lint/suspicious/noShadowRestrictedNames: <explanation>
import { toString } from 'mdast-util-to-string'
import getReadingTime from 'reading-time'
export function remarkReadingTime() {
return (tree, { data }) => {
const textOnPage = toString(tree)
const readingTime = getReadingTime(textOnPage)
data.astro.frontmatter.minutes = Math.max(
1,
Math.round(readingTime.minutes),
)
data.astro.frontmatter.words = readingTime.words
}
}