Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
59 changes: 59 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Deploy VitePress site to Pages

on:
push:
branches:
- main
workflow_dispatch:

permissions:
contents: read
pages: write
id-token: write

concurrency:
group: pages
cancel-in-progress: false

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v5
with:
fetch-depth: 0

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 20
cache: npm

- name: Setup Pages
uses: actions/configure-pages@v5

- name: Install dependencies
run: npm ci

- name: Normalize markdown links
run: npm run docs:fix-links

- name: Build with VitePress
run: npm run docs:build

- name: Upload Pages artifact
uses: actions/upload-pages-artifact@v4
with:
path: .vitepress/dist

deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
needs: build
runs-on: ubuntu-latest
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
node_modules/
.vitepress/cache/
.vitepress/dist/
dist/
.omx/
.DS_Store
52 changes: 52 additions & 0 deletions .vitepress/config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import { defineConfig } from 'vitepress';
import { buildNav, buildRewrites, buildSidebar } from '../scripts/docs-tools.mjs';

export default defineConfig({
lang: 'zh-CN',
title: 'Embed Book',
description: '嵌入式软件开发全景知识库,覆盖 C 语言、驱动开发、RTOS、Embedded Linux、IoT 与 AI on MCU。',
base: '/Embed_book/',
srcExclude: ['README.md', 'LICENSE.md', '.omx/**', 'node_modules/**'],
cleanUrls: true,
rewrites: buildRewrites(),
ignoreDeadLinks: [/^http:\/\/localhost:\d+/],
lastUpdated: true,
head: [
['meta', { name: 'theme-color', content: '#0f172a' }],
['meta', { property: 'og:type', content: 'website' }],
['meta', { property: 'og:title', content: 'Embed Book' }],
['meta', { property: 'og:description', content: '为嵌入式软件学习打造的可阅读、可导航静态文档站。' }]
],
themeConfig: {
siteTitle: 'Embed Book',
logo: '/1.png',
nav: buildNav(),
sidebar: buildSidebar(),
socialLinks: [
{ icon: 'github', link: 'https://github.com/liueggy/Embed_book' }
],
search: {
provider: 'local'
},
outline: {
level: [2, 3],
label: '本页目录'
},
docFooter: {
prev: '上一页',
next: '下一页'
},
returnToTopLabel: '返回顶部',
sidebarMenuLabel: '导航',
darkModeSwitchLabel: '主题',
lightModeSwitchTitle: '切换到浅色模式',
darkModeSwitchTitle: '切换到深色模式',
lastUpdated: {
text: '最后更新于'
},
footer: {
message: '以 GitHub Pages 发布,使用 VitePress 构建。',
copyright: 'Content under CC BY-NC-SA 4.0 where applicable.'
}
}
});
157 changes: 157 additions & 0 deletions .vitepress/theme/custom.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
:root {
--vp-c-brand-1: #1f4b6e;
--vp-c-brand-2: #173a57;
--vp-c-brand-3: #102a40;
--vp-c-brand-soft: rgba(31, 75, 110, 0.1);
--vp-home-hero-name-color: #0f172a;
--vp-home-hero-name-background: none;
--vp-home-hero-image-background-image: none;
--vp-home-hero-image-filter: none;
}

.VPHero.has-image .name,
.VPHero .name {
letter-spacing: -0.02em;
}

.VPHome .VPHero {
margin-top: 20px;
border: 1px solid rgba(148, 163, 184, 0.22);
border-radius: 18px;
background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
box-shadow: none;
}

.dark .VPHome .VPHero {
background: linear-gradient(180deg, #111827 0%, #0f172a 100%);
border-color: rgba(148, 163, 184, 0.18);
}

.VPHome .VPHero::after {
display: none;
}

.VPHome .VPHero .container {
padding-top: 52px;
padding-bottom: 40px;
}

.VPHome .VPHero .text,
.VPHome .VPHero .tagline {
color: var(--vp-c-text-2);
}

.VPHome .VPHero .action.alt {
color: var(--vp-c-text-1);
border-color: rgba(148, 163, 184, 0.3);
background: transparent;
}

.portal-strip {
margin: 24px 0 20px;
padding: 12px 14px;
border: 1px solid rgba(148, 163, 184, 0.18);
border-radius: 12px;
background: #f8fafc;
color: var(--vp-c-text-2);
font-size: 14px;
}

.dark .portal-strip {
background: rgba(15, 23, 42, 0.55);
}

.portal-index {
display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr));
gap: 20px;
margin: 20px 0 28px;
}

.portal-block {
padding: 18px 20px;
border: 1px solid rgba(148, 163, 184, 0.18);
border-radius: 14px;
background: var(--vp-c-bg-soft);
}

.portal-block h3 {
margin: 0 0 12px;
font-size: 17px;
}

.portal-block ol,
.portal-block ul {
margin: 0;
padding-left: 18px;
}

.portal-block li {
margin: 8px 0;
line-height: 1.6;
}

.portal-table {
margin: 16px 0 28px;
border: 1px solid rgba(148, 163, 184, 0.18);
border-radius: 14px;
overflow: hidden;
background: var(--vp-c-bg-soft);
}

.portal-row {
display: grid;
grid-template-columns: 240px minmax(0, 1fr);
gap: 18px;
padding: 16px 18px;
color: inherit;
text-decoration: none;
border-top: 1px solid rgba(148, 163, 184, 0.14);
transition: background-color 0.18s ease;
}

.portal-row:first-child {
border-top: 0;
}

.portal-row:hover {
background: rgba(148, 163, 184, 0.08);
}

.portal-row strong {
font-size: 15px;
font-weight: 600;
}

.portal-row span {
color: var(--vp-c-text-2);
line-height: 1.6;
}

.portal-image {
margin: 18px 0 10px;
overflow: hidden;
border: 1px solid rgba(148, 163, 184, 0.18);
border-radius: 16px;
background: #fff;
}

.dark .portal-image {
background: #0f172a;
}

.portal-image img {
display: block;
width: 100%;
}

@media (max-width: 768px) {
.portal-index {
grid-template-columns: 1fr;
}

.portal-row {
grid-template-columns: 1fr;
gap: 6px;
}
}
7 changes: 7 additions & 0 deletions .vitepress/theme/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import DefaultTheme from 'vitepress/theme';
import './custom.css';

export default {
extends: DefaultTheme
};

Loading
Loading