mirror of
https://github.com/cupcakearmy/nicco.io.git
synced 2025-09-06 02:30:45 +00:00
astro first commit
This commit is contained in:
10
readingTime.js
Normal file
10
readingTime.js
Normal file
@@ -0,0 +1,10 @@
|
||||
import getReadingTime from 'reading-time'
|
||||
import { toString } from 'mdast-util-to-string'
|
||||
|
||||
export function remarkReadingTime() {
|
||||
return function (tree, { data }) {
|
||||
const textOnPage = toString(tree)
|
||||
const readingTime = getReadingTime(textOnPage)
|
||||
data.astro.frontmatter.readingTime = readingTime
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user