mirror of
https://github.com/riba2534/TCP-IP-NetworkNote.git
synced 2026-07-02 10:56:06 +08:00
将笔记转化为精美的 VitePress 静态电子书网站: - site/ 工程目录:构建脚本从 chXX/README.md + .c 源码 + images/ 幂等生成 19 个章节页 + 96 个源码页(每个 .c 独立页面,Shiki 语法高亮) - 构建脚本零依赖,处理 3 种代码链接形态(同章/跨章/绝对URL)+ 110 处图片路径转换,保持原 Markdown 结构不变 - 首页 hero 用 AI 生成的网络主题封面图,配套 favicon 多尺寸 - 中文衬线正文排版 + GitHub 风格代码主题 + 本地全文搜索 - GitHub Actions + wrangler 自动部署到 Cloudflare Pages - 域名 tcp.riba2534.cn 原 chXX/ 目录与根 README 保持不动,网站内容每次构建从源重新生成。
77 lines
2.3 KiB
TypeScript
77 lines
2.3 KiB
TypeScript
import { defineConfig } from 'vitepress'
|
|
import { CHAPTERS } from './chapters.mjs'
|
|
|
|
export default defineConfig({
|
|
title: 'TCP/IP 网络编程学习笔记',
|
|
description: '《TCP/IP 网络编程》学习笔记电子书',
|
|
lang: 'zh-CN',
|
|
cleanUrls: true,
|
|
lastUpdated: true,
|
|
|
|
markdown: {
|
|
theme: { light: 'github-light', dark: 'github-dark' },
|
|
lineNumbers: true,
|
|
},
|
|
|
|
head: [
|
|
['meta', { name: 'viewport', content: 'width=device-width,initial-scale=1' }],
|
|
['link', { rel: 'icon', type: 'image/png', sizes: '32x32', href: '/favicon-32.png' }],
|
|
['link', { rel: 'icon', type: 'image/png', sizes: '180x180', href: '/favicon-180.png' }],
|
|
['link', { rel: 'apple-touch-icon', sizes: '180x180', href: '/favicon-180.png' }],
|
|
['link', { rel: 'mask-icon', href: '/favicon-512.png', color: '#06b6d4' }],
|
|
['meta', { name: 'theme-color', content: '#0a0e27' }],
|
|
['meta', { property: 'og:image', content: '/cover.png' }],
|
|
],
|
|
|
|
themeConfig: {
|
|
siteTitle: 'TCP/IP 网络编程笔记',
|
|
outline: { level: [2, 3], label: '本页目录' },
|
|
docFooter: { prev: '上一章', next: '下一章' },
|
|
lastUpdatedText: '最后更新',
|
|
returnToTopLabel: '回到顶部',
|
|
sidebarMenuLabel: '目录',
|
|
|
|
search: {
|
|
provider: 'local',
|
|
options: {
|
|
translations: {
|
|
button: { buttonText: '搜索', buttonAriaLabel: '搜索' },
|
|
modal: {
|
|
displayDetails: '显示详情',
|
|
resetButtonTitle: '清除查询',
|
|
backButtonTitle: '返回',
|
|
noResultsText: '无结果',
|
|
footer: {
|
|
selectText: '选择',
|
|
navigateText: '切换',
|
|
closeText: '关闭',
|
|
},
|
|
},
|
|
},
|
|
},
|
|
},
|
|
|
|
nav: [
|
|
{ text: '首页', link: '/' },
|
|
{ text: 'GitHub 仓库', link: 'https://github.com/riba2534/TCP-IP-NetworkNote' },
|
|
],
|
|
|
|
sidebar: [
|
|
{
|
|
text: '章节',
|
|
collapsed: false,
|
|
items: CHAPTERS.map((c) => ({ text: c.title, link: `/${c.dir}/` })),
|
|
},
|
|
],
|
|
|
|
socialLinks: [
|
|
{ icon: 'github', link: 'https://github.com/riba2534/TCP-IP-NetworkNote' },
|
|
],
|
|
|
|
footer: {
|
|
message: '基于 VitePress 构建,部署于 Cloudflare Pages',
|
|
copyright: 'Copyright © riba2534',
|
|
},
|
|
},
|
|
})
|