mirror of
https://github.com/saicaca/fuwari.git
synced 2026-01-11 06:42:53 +01:00
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:
111
astro.config.mjs
111
astro.config.mjs
@@ -1,57 +1,74 @@
|
||||
import { defineConfig } from 'astro/config';
|
||||
import yaml from '@rollup/plugin-yaml';
|
||||
import icon from "astro-icon";
|
||||
import tailwind from "@astrojs/tailwind"
|
||||
import yaml from "@rollup/plugin-yaml"
|
||||
import Compress from "astro-compress"
|
||||
import icon from "astro-icon"
|
||||
import { defineConfig } from "astro/config"
|
||||
import Color from "colorjs.io"
|
||||
import rehypeAutolinkHeadings from "rehype-autolink-headings"
|
||||
import rehypeKatex from "rehype-katex"
|
||||
import rehypeSlug from "rehype-slug"
|
||||
import remarkMath from "remark-math"
|
||||
import { remarkReadingTime } from "./src/plugins/remark-reading-time.mjs"
|
||||
|
||||
import tailwind from "@astrojs/tailwind";
|
||||
import {remarkReadingTime} from "./src/plugins/remark-reading-time.mjs";
|
||||
|
||||
import rehypeKatex from "rehype-katex";
|
||||
|
||||
import Color from 'colorjs.io';
|
||||
import remarkMath from "remark-math";
|
||||
import rehypeAutolinkHeadings from "rehype-autolink-headings";
|
||||
import rehypeSlug from "rehype-slug";
|
||||
|
||||
// https://astro.build/config
|
||||
|
||||
|
||||
const oklchToHex = function (str) {
|
||||
const DEFAULT_HUE = 250;
|
||||
const regex = /-?\d+(\.\d+)?/g;
|
||||
const matches = str.string.match(regex);
|
||||
const lch = [matches[0], matches[1], DEFAULT_HUE];
|
||||
return new Color("oklch", lch).to("srgb").toString({format: "hex"});
|
||||
const oklchToHex = (str) => {
|
||||
const DEFAULT_HUE = 250
|
||||
const regex = /-?\d+(\.\d+)?/g
|
||||
const matches = str.string.match(regex)
|
||||
const lch = [matches[0], matches[1], DEFAULT_HUE]
|
||||
return new Color("oklch", lch).to("srgb").toString({
|
||||
format: "hex",
|
||||
})
|
||||
}
|
||||
|
||||
// https://astro.build/config
|
||||
export default defineConfig({
|
||||
site: 'https://fuwari.vercel.app/',
|
||||
base: '/',
|
||||
site: "https://fuwari.vercel.app/",
|
||||
base: "/",
|
||||
integrations: [
|
||||
tailwind(),
|
||||
icon({
|
||||
include: {
|
||||
'material-symbols': ['*'],
|
||||
'fa6-brands': ['*'],
|
||||
'fa6-regular': ['*'],
|
||||
'fa6-solid': ['*']
|
||||
}
|
||||
})
|
||||
"material-symbols": ["*"],
|
||||
"fa6-brands": ["*"],
|
||||
"fa6-regular": ["*"],
|
||||
"fa6-solid": ["*"],
|
||||
},
|
||||
}),
|
||||
Compress({
|
||||
Image: false,
|
||||
}),
|
||||
],
|
||||
markdown: {
|
||||
remarkPlugins: [remarkMath, remarkReadingTime],
|
||||
rehypePlugins: [rehypeKatex, rehypeSlug,
|
||||
[rehypeAutolinkHeadings, {
|
||||
behavior: 'append',
|
||||
properties: {className: ['anchor']},
|
||||
content: {
|
||||
type: 'element',
|
||||
tagName: 'span',
|
||||
properties: {className: ['anchor-icon']},
|
||||
children: [{type: 'text', value: '#'}]
|
||||
}}]]
|
||||
rehypePlugins: [
|
||||
rehypeKatex,
|
||||
rehypeSlug,
|
||||
[
|
||||
rehypeAutolinkHeadings,
|
||||
{
|
||||
behavior: "append",
|
||||
properties: {
|
||||
className: ["anchor"],
|
||||
},
|
||||
content: {
|
||||
type: "element",
|
||||
tagName: "span",
|
||||
properties: {
|
||||
className: ["anchor-icon"],
|
||||
},
|
||||
children: [
|
||||
{
|
||||
type: "text",
|
||||
value: "#",
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
],
|
||||
],
|
||||
},
|
||||
redirects: {
|
||||
'/': '/page/1',
|
||||
"/": "/page/1",
|
||||
},
|
||||
vite: {
|
||||
plugins: [yaml()],
|
||||
@@ -59,10 +76,10 @@ export default defineConfig({
|
||||
preprocessorOptions: {
|
||||
stylus: {
|
||||
define: {
|
||||
oklchToHex: oklchToHex
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
oklchToHex: oklchToHex,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user