mirror of
https://github.com/reonokiy/blog.nokiy.net.git
synced 2025-06-18 04:06:05 +02:00
style: add image to figure plugin
- Improve styles for images, blockquotes, tables and more - Fix unexpected line breaks
This commit is contained in:
parent
018f1c9b6c
commit
4ff44f9ac4
14 changed files with 126 additions and 59 deletions
13
src/plugins/remark-reading-time.mjs
Normal file
13
src/plugins/remark-reading-time.mjs
Normal file
|
@ -0,0 +1,13 @@
|
|||
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),
|
||||
)
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue