Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
60e41b4
feat(config): 更新站点和个人资料配置为中文内容
Uranus-Queen Oct 29, 2025
fd0d610
feat(config): 更新站点地址并添加自定义复制按钮插件
Uranus-Queen Oct 29, 2025
94a29de
Implement code changes to enhance functionality and improve performance
Uranus-Queen Oct 29, 2025
9cc4322
feat(settings): 更新VSCode设置以支持Markdown格式化和验证
Uranus-Queen Oct 30, 2025
a8e691e
Refactor code structure for improved readability and maintainability
Uranus-Queen Nov 1, 2025
fa97ab6
fix(about): 修复图片链接以确保正确显示
Uranus-Queen Nov 1, 2025
39a1dea
feat(blog): 添加第一篇博客的初始内容和元数据
Uranus-Queen Nov 1, 2025
c951f52
Add first blog post with initial content and metadata
Uranus-Queen Nov 1, 2025
4dfa837
delete(guide): 移除指南封面图片和相关索引文件
Uranus-Queen Nov 1, 2025
bf2f8e9
feat(about): 更新关于页面,添加图片描述和内容
Uranus-Queen Nov 1, 2025
6ad714f
Refactor code structure for improved readability and maintainability
Uranus-Queen Nov 4, 2025
0ba9c55
feat(post): 添加关于宿舍矛盾的文章及相关图片
Uranus-Queen Nov 4, 2025
e90acc3
feat(meta): 添加msvalidate.01元数据以增强SEO优化
Uranus-Queen Nov 5, 2025
dcb3d97
回退到了之前的版本
Uranus-Queen Nov 21, 2025
9e10095
不知道修改了什么
Uranus-Queen Nov 21, 2025
45890df
网站地图
Uranus-Queen Nov 21, 2025
cb88df6
feat(post): 添加nmap学习笔记文档
Uranus-Queen Dec 6, 2025
a7921e4
fix: correct date format in nmap学习笔记 post
Uranus-Queen Dec 6, 2025
b4ea125
更换了自己的图床
Uranus-Queen Dec 8, 2025
0ae8487
feat(post): 添加文献内容精校与中文翻译文档
Uranus-Queen Apr 15, 2026
cd6abe8
feat(post): 添加张硕快看,好好干文档及失效分析大赛PPT制作指南
Uranus-Queen Apr 16, 2026
e4750f1
```
Uranus-Queen Apr 16, 2026
c143a4c
feat: update blog post content and images, enhance layout styles, and…
Uranus-Queen Jun 1, 2026
9f0e91c
fix: 修正 tsconfig.json 中的路径配置,确保模块解析正确
Uranus-Queen Jun 1, 2026
17f8de1
fix(ButtonLink): 修正暗黑模式下徽章文本颜色为黑色
Uranus-Queen Jun 1, 2026
5a6ae17
Merge upstream/main (saicaca/fuwari) into main; keep our Astro 6 / Ta…
Uranus-Queen Nov 13, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 31 additions & 20 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,22 +1,33 @@
{
"editor.formatOnSave": true,
"editor.defaultFormatter": "biomejs.biome",
"[javascript]": {
"editor.defaultFormatter": "biomejs.biome"
},
"[javascriptreact]": {
"editor.defaultFormatter": "biomejs.biome"
},
"[typescript]": {
"editor.defaultFormatter": "biomejs.biome"
},
"[typescriptreact]": {
"editor.defaultFormatter": "biomejs.biome"
},
"editor.codeActionsOnSave": {
"source.fixAll": "explicit",
"quickfix.biome": "always",
"source.organizeImports.biome": "always"
},
"frontMatter.dashboard.openOnStart": false
"css.validate": false,
"less.validate": false,
"scss.validate": false,
Comment on lines +2 to +4
"tailwindCSS.includeLanguages": {
"astro": "html",
"svelte": "html"
},
"editor.formatOnSave": true,
"editor.defaultFormatter": "biomejs.biome",
"[javascript]": {
"editor.defaultFormatter": "biomejs.biome"
},
"[javascriptreact]": {
"editor.defaultFormatter": "biomejs.biome"
},
"[typescript]": {
"editor.defaultFormatter": "biomejs.biome"
},
"[typescriptreact]": {
"editor.defaultFormatter": "biomejs.biome"
},
"editor.codeActionsOnSave": {
"source.fixAll.biome": "explicit"
},
"frontMatter.dashboard.openOnStart": false,
"[markdown]": {
"editor.defaultFormatter": "esbenp.prettier-vscode"
},
"markdown.validate.enabled": true,
"files.autoSave": "onFocusChange",
"editor.aiStats.enabled": true
}
79 changes: 79 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
# CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

## Project Overview

Fuwari is a static blog template built on **Astro 6** with **Svelte 5** islands, **Tailwind CSS 3**, and **Stylus**. It deploys to **Vercel** at `https://zhangjun.xyz`. The site language is Chinese (`zh_CN`).

## Commands

```bash
pnpm dev # Dev server at localhost:4321
pnpm build # Production build (astro build → pagefind → sitemap)
pnpm preview # Preview production build
pnpm check # Astro type/error checking
pnpm type-check # TypeScript strict check
pnpm lint # Biome lint with auto-fix (biome check --write ./src)
pnpm format # Biome format (biome format --write ./src)
pnpm new-post <name> # Scaffold a new post in src/content/posts/
```

Package manager is **pnpm** (enforced via `only-allow pnpm` in preinstall script). No test framework is configured.

## Architecture

### Rendering Pipeline

Posts (markdown in `src/content/posts/`) → Astro content collections with Zod schema (`src/content/config.ts`) → Remark/Rehype plugin chain (`astro.config.mjs`) → Static HTML. Search index built via Pagefind at build time.

### Component Strategy

- **`.astro` files** — static SSG components (layouts, cards, nav, sidebar widgets). Zero client JS.
- **`.svelte` files** — interactive islands loaded with `client:only="svelte"` (search, dark mode toggle, archive panel, display settings).

### Theming

Color system uses oklch with a single `--hue` CSS custom property (`src/styles/variables.styl`). All colors derive from this hue. Dark mode is class-based (`class` strategy in Tailwind config), persisted in localStorage and applied before render to prevent FOUC. Users can change the hue via a slider in display settings.

### Key Source Layout

| Area | Path | Purpose |
|---|---|---|
| Blog config | `src/config.ts` | Site title, theme color, navbar, profile, license settings |
| Content schema | `src/content/config.ts` | Zod frontmatter schema (title, published, tags, category, etc.) |
| Content utils | `src/utils/content-utils.ts` | `getSortedPosts()`, tag/category aggregation, prev/next links |
| Types | `src/types/config.ts` | TypeScript types for all config structures |
| i18n | `src/i18n/` | 10 languages; enum keys in `i18nKey.ts`, translations in `languages/` |
| Styles | `src/styles/` | `variables.styl` (theme vars), `main.css` (Tailwind components), `markdown.css` |
| Plugins | `src/plugins/` | Remark (reading time, excerpts) and Rehype (admonitions, GitHub cards, KaTeX) plugins |
| Layouts | `src/layouts/` | `Layout.astro` (root HTML), `MainGridLayout.astro` (navbar + sidebar + content grid) |
| Pages | `src/pages/` | File-based routing: `[...page].astro` (home, paginated), `posts/[...slug].astro`, `archive.astro`, `about.astro` |

### Path Aliases (tsconfig.json)

`@components/*`, `@assets/*`, `@constants/*`, `@utils/*`, `@i18n/*`, `@layouts/*`, `@/*` — all resolve to `src/`.

## Blog Post Frontmatter

```yaml
---
title: "Post Title"
published: 2025-01-15 # Required, Date
updated: 2025-01-20 # Optional
draft: false # Excluded from production builds
description: ""
image: "" # Cover image (URL or relative path)
tags: [tag1, tag2]
category: "Category"
lang: "" # Override site language per-post
---
```

## Code Style

**Biome** with tabs and double quotes. `.svelte` and `.astro` files have relaxed rules (no `useConst`, `useImportType`, `noUnusedVariables` enforcement). Run `pnpm lint` before committing. CI runs `biome ci ./src --reporter=github`.

## Markdown Extensions

Posts support: admonitions (`:::note`, `:::tip`, `:::warning`, etc.), GitHub cards (`::github{repo="user/repo"}`), KaTeX math (`$...$` inline, `$$...$$` display), Expressive Code blocks with collapsible sections, and reading time auto-calculation.
39 changes: 23 additions & 16 deletions astro.config.mjs
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import sitemap from "@astrojs/sitemap";
import svelte from "@astrojs/svelte";
import tailwind from "@astrojs/tailwind";
import { pluginCollapsibleSections } from "@expressive-code/plugin-collapsible-sections";
import { pluginLineNumbers } from "@expressive-code/plugin-line-numbers";
import swup from "@swup/astro";
import { defineConfig } from "astro/config";
import expressiveCode from "astro-expressive-code";
import icon from "astro-icon";
import { defineConfig } from "astro/config";
import rehypeAutolinkHeadings from "rehype-autolink-headings";
import rehypeComponents from "rehype-components"; /* Render the custom directive content */
import rehypeKatex from "rehype-katex";
Expand All @@ -16,23 +15,20 @@ import remarkGithubAdmonitionsToDirectives from "remark-github-admonitions-to-di
import remarkMath from "remark-math";
import remarkSectionize from "remark-sectionize";
import { expressiveCodeConfig } from "./src/config.ts";
import { pluginCustomCopyButton } from "./src/plugins/expressive-code/custom-copy-button.ts";
import { pluginLanguageBadge } from "./src/plugins/expressive-code/language-badge.ts";
import { AdmonitionComponent } from "./src/plugins/rehype-component-admonition.mjs";
import { GithubCardComponent } from "./src/plugins/rehype-component-github-card.mjs";
import { parseDirectiveNode } from "./src/plugins/remark-directive-rehype.js";
import { remarkExcerpt } from "./src/plugins/remark-excerpt.js";
import { remarkReadingTime } from "./src/plugins/remark-reading-time.mjs";
import { pluginCustomCopyButton } from "./src/plugins/expressive-code/custom-copy-button.js";

// https://astro.build/config
export default defineConfig({
site: "https://fuwari.vercel.app/",
site: "https://zhangjun.xyz",
base: "/",
trailingSlash: "always",
integrations: [
tailwind({
nesting: true,
}),
swup({
theme: false,
animationClass: "transition-swup-", // see https://swup.js.org/options/#animationselector
Expand Down Expand Up @@ -61,12 +57,12 @@ export default defineConfig({
pluginCollapsibleSections(),
pluginLineNumbers(),
pluginLanguageBadge(),
pluginCustomCopyButton()
pluginCustomCopyButton(),
],
defaultProps: {
wrap: true,
overridesByLang: {
'shellsession': {
shellsession: {
showLineNumbers: false,
},
},
Expand All @@ -76,7 +72,8 @@ export default defineConfig({
borderRadius: "0.75rem",
borderColor: "none",
codeFontSize: "0.875rem",
codeFontFamily: "'JetBrains Mono Variable', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace",
codeFontFamily:
"'JetBrains Mono Variable', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace",
codeLineHeight: "1.5rem",
frames: {
editorBackground: "var(--codeblock-bg)",
Expand All @@ -87,20 +84,30 @@ export default defineConfig({
editorActiveTabIndicatorBottomColor: "var(--primary)",
editorActiveTabIndicatorTopColor: "none",
editorTabBarBorderBottomColor: "var(--codeblock-topbar-bg)",
terminalTitlebarBorderBottomColor: "none"
terminalTitlebarBorderBottomColor: "none",
},
textMarkers: {
delHue: 0,
insHue: 180,
markHue: 250
}
markHue: 250,
},
},
frames: {
showCopyToClipboardButton: false,
},
}),
svelte(),
sitemap({
filter: (page) => !page.includes('/404'), // 1️⃣ 先过滤垃圾页
customPages: ['https://zhangjun.xyz/about'], // 2️⃣ 非 src/pages 的静态页
changefreq: 'daily',
priority: 0.5, // 3️⃣ 权重 - 设置为单个数字
lastmod: new Date(), // 4️⃣ 统一时间戳
serialize: async (item) => {
// 返回默认的序列化对象,保持默认行为
return item;
}
}),
Comment on lines +100 to 110
svelte(),
sitemap(),
],
markdown: {
remarkPlugins: [
Expand Down Expand Up @@ -169,4 +176,4 @@ export default defineConfig({
},
},
},
});
});
43 changes: 21 additions & 22 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,38 +6,34 @@
"dev": "astro dev",
"start": "astro dev",
"check": "astro check",
"build": "astro build && pagefind --site dist",
"build": "astro build && pagefind --site dist && node scripts/generate-sitemap.js",
"preview": "astro preview",
"astro": "astro",
"type-check": "tsc --noEmit --isolatedDeclarations",
"type-check": "tsc --noEmit",
"new-post": "node scripts/new-post.js",
"format": "biome format --write ./src",
"lint": "biome check --write ./src",
"preinstall": "npx only-allow pnpm"
},
"dependencies": {
"@astrojs/check": "^0.9.6",
"@astrojs/rss": "^4.0.14",
"@astrojs/sitemap": "^3.6.0",
"@astrojs/svelte": "7.2.3",
"@astrojs/tailwind": "^6.0.2",
"@expressive-code/core": "^0.41.4",
"@expressive-code/plugin-collapsible-sections": "^0.41.4",
"@expressive-code/plugin-line-numbers": "^0.41.4",
"@astrojs/check": "^0.9.9",
"@astrojs/svelte": "8.1.2",
"@expressive-code/core": "^0.41.3",
"@expressive-code/plugin-collapsible-sections": "^0.41.3",
"@expressive-code/plugin-line-numbers": "^0.41.3",
"@fontsource-variable/jetbrains-mono": "^5.2.8",
"@fontsource/roboto": "^5.2.9",
"@fontsource/roboto": "^5.2.8",
"@iconify-json/fa6-brands": "^1.2.6",
"@iconify-json/fa6-regular": "^1.2.4",
"@iconify-json/fa6-solid": "^1.2.4",
"@iconify-json/material-symbols": "^1.2.50",
"@iconify-json/material-symbols": "^1.2.40",
"@iconify/svelte": "^4.2.0",
"@swup/astro": "^1.7.0",
"@tailwindcss/typography": "^0.5.19",
"astro": "5.13.10",
"astro-expressive-code": "^0.41.4",
"astro": "6.4.2",
"astro-expressive-code": "^0.41.3",
"astro-icon": "^1.1.5",
"hastscript": "^9.0.1",
"katex": "^0.16.27",
"katex": "^0.16.23",
"markdown-it": "^14.1.0",
"mdast-util-to-string": "^4.0.0",
"overlayscrollbars": "^2.12.0",
Expand All @@ -54,23 +50,26 @@
"remark-math": "^6.0.0",
"remark-sectionize": "^2.1.0",
"sanitize-html": "^2.17.0",
"sharp": "^0.34.5",
"sharp": "^0.34.4",
"stylus": "^0.64.0",
"svelte": "^5.39.8",
"tailwindcss": "^3.4.19",
"typescript": "^5.9.3",
"unist-util-visit": "^5.0.0"
},
"devDependencies": {
"@astrojs/ts-plugin": "^1.10.6",
"@astrojs/rss": "^4.0.18",
"@astrojs/sitemap": "^3.7.3",
"@astrojs/ts-plugin": "^1.10.9",
"@biomejs/biome": "2.2.5",
"@rollup/plugin-yaml": "^4.1.2",
"@tailwindcss/postcss": "^4.3.0",
"@tailwindcss/typography": "^0.5.19",
"@tailwindcss/vite": "^4.3.0",
"@types/hast": "^3.0.4",
"@types/markdown-it": "^14.1.2",
"@types/mdast": "^4.0.4",
"@types/sanitize-html": "^2.16.0",
"postcss-import": "^16.1.1",
"postcss-nesting": "^13.0.2"
"tailwindcss": "^4.3.0"
},
"packageManager": "pnpm@9.14.4"
}
}
Loading