feat: add FrontMatter CMS, biome, translation, etc.

* add Frontmatter CMS

* add biome

* update

* update

* fixed & add docs

* fix translation.ts

* fix translation
This commit is contained in:
L4Ph
2024-01-21 13:54:41 +09:00
committed by GitHub
parent f9a78b3e3b
commit 197d524b53
42 changed files with 2714 additions and 12795 deletions

View File

@@ -1,11 +1,15 @@
import getReadingTime from 'reading-time';
import { toString } from 'mdast-util-to-string';
// biome-ignore lint/suspicious/noShadowRestrictedNames: <explanation>
import { toString } from 'mdast-util-to-string'
import getReadingTime from 'reading-time'
export function remarkReadingTime() {
return function (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;
};
}
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
}
}