-
Notifications
You must be signed in to change notification settings - Fork 182
增加部署到pages,以及部分章节优化 #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
liueggy
wants to merge
14
commits into
0voice:main
Choose a base branch
from
liueggy:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
429314b
Spin the markdown knowledge base into a publishable reading site
liueggy 51c5ef7
Remove emojis from README.md
Claude 11b6467
Merge pull request #1 from liueggy/claude/update-readme-file
liueggy 2bd6578
更新 README.md
liueggy e84484c
更新 README.md
liueggy 49963fa
Make the home page read like a technical index instead of a blog land…
liueggy 3013bf0
Improve chapter readability and remove emoji-heavy note styling
liueggy 7c69b2a
Simplify homepage: remove verbose descriptions and streamline layout
Claude 21ee8e6
更新后续章节
liueggy 84ead92
优化pages展示,使用vue组件
liueggy af396b0
优化主页展示,缩小字体,居中显示
liueggy e06b732
修改主页背景
liueggy 344f610
修复仓库内PDF404问题
liueggy 6b89123
修复fix-links对public静态资源的双重编码问题
liueggy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| node_modules/ | ||
| .vitepress/cache/ | ||
| .vitepress/dist/ | ||
| dist/ | ||
| .omx/ | ||
| .DS_Store |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| import { defineConfig } from 'vitepress'; | ||
| import { buildNav, buildRewrites, buildSidebar } from '../scripts/docs-tools.mjs'; | ||
|
|
||
| export default defineConfig({ | ||
| vite: { | ||
| ssr: { | ||
| noExternal: ['element-plus'] | ||
| } | ||
| }, | ||
| 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.' | ||
| } | ||
| } | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,98 @@ | ||
| <script setup lang="ts"> | ||
| import { computed } from 'vue'; | ||
| import { useData, useRoute, withBase } from 'vitepress'; | ||
|
|
||
| const route = useRoute(); | ||
| const { frontmatter } = useData(); | ||
|
|
||
| interface Crumb { | ||
| text: string; | ||
| link?: string; | ||
| } | ||
|
|
||
| const sectionNameMap: Record<string, string> = { | ||
| '01-C语言基础与进阶': 'C 语言基础与进阶', | ||
| '02-嵌入式系统基础知识': '嵌入式系统基础知识', | ||
| '03-驱动开发与外设编程': '驱动开发与外设编程', | ||
| '04-实时操作系统': '实时操作系统', | ||
| '05-EmbeddedLinux': 'Embedded Linux', | ||
| '06-NetworkIot': '网络通信与物联网', | ||
| '07-Debug_Optimization': '调试与性能优化', | ||
| '08-项目实战与工具链': '项目实战与工具链', | ||
| '09-2025_AI_on_MCU': '2025 AI on MCU', | ||
| '嵌入式图形 Qt 开发': '嵌入式图形 Qt 开发', | ||
| '面试题与面经': '面试题与面经', | ||
| 'books': '资源下载' | ||
| }; | ||
|
|
||
| const crumbs = computed<Crumb[]>(() => { | ||
| const path = route.path; | ||
|
|
||
| // Don't show breadcrumb on home page | ||
| if (path === '/' || path === '') return []; | ||
|
|
||
| // Also skip if it's the home layout | ||
| if (frontmatter.value.layout === 'home') return []; | ||
|
|
||
| const items: Crumb[] = [{ text: '首页', link: '/' }]; | ||
|
|
||
| // Decode the path for matching | ||
| const decoded = decodeURIComponent(path); | ||
| const segments = decoded.replace(/^\//, '').replace(/\/$/, '').split('/'); | ||
|
|
||
| if (segments.length === 0) return items; | ||
|
|
||
| // First segment is typically the section dir | ||
| const sectionDir = segments[0]; | ||
| const sectionName = sectionNameMap[sectionDir]; | ||
|
|
||
| if (sectionName) { | ||
| if (segments.length === 1 || (segments.length === 1 && decoded.endsWith('/'))) { | ||
| items.push({ text: sectionName }); | ||
| } else { | ||
| items.push({ | ||
| text: sectionName, | ||
| link: `/${encodeURIComponent(sectionDir)}/` | ||
| }); | ||
| // Page name - remove .html extension if present | ||
| const pageName = segments[segments.length - 1].replace(/\.html$/, ''); | ||
| items.push({ text: pageName }); | ||
| } | ||
| } else { | ||
| // Fallback for other pages like study-map, resources | ||
| const pageName = segments[segments.length - 1].replace(/\.html$/, ''); | ||
| items.push({ text: pageName }); | ||
| } | ||
|
|
||
| return items; | ||
| }); | ||
| </script> | ||
|
|
||
| <template> | ||
| <el-breadcrumb v-if="crumbs.length > 0" separator="/" class="doc-breadcrumb"> | ||
| <el-breadcrumb-item | ||
| v-for="(crumb, index) in crumbs" | ||
| :key="index" | ||
| > | ||
| <a v-if="crumb.link" :href="withBase(crumb.link)">{{ crumb.text }}</a> | ||
| <span v-else>{{ crumb.text }}</span> | ||
| </el-breadcrumb-item> | ||
| </el-breadcrumb> | ||
| </template> | ||
|
|
||
| <style scoped> | ||
| .doc-breadcrumb { | ||
| margin-bottom: 16px; | ||
| padding: 8px 0; | ||
| font-size: 13px; | ||
| } | ||
|
|
||
| .doc-breadcrumb a { | ||
| color: var(--vp-c-brand-1); | ||
| text-decoration: none; | ||
| } | ||
|
|
||
| .doc-breadcrumb a:hover { | ||
| text-decoration: underline; | ||
| } | ||
| </style> |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.