-
Notifications
You must be signed in to change notification settings - Fork 90
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #32 from Suzukaze7/vitepress
Deploy GitHub Pages
- Loading branch information
Showing
16 changed files
with
1,793 additions
and
4 deletions.
There are no files selected for viewing
This file contains 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,64 @@ | ||
# 构建 VitePress 站点并将其部署到 GitHub Pages 的示例工作流程 | ||
# | ||
name: Deploy VitePress site to Pages | ||
|
||
on: | ||
# 在针对 `main` 分支的推送上运行。如果你 | ||
# 使用 `master` 分支作为默认分支,请将其更改为 `master` | ||
push: | ||
branches: [vitepress] | ||
|
||
# 允许你从 Actions 选项卡手动运行此工作流程 | ||
workflow_dispatch: | ||
|
||
# 设置 GITHUB_TOKEN 的权限,以允许部署到 GitHub Pages | ||
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@v4 | ||
with: | ||
fetch-depth: 0 # 如果未启用 lastUpdated,则不需要 | ||
# - uses: pnpm/action-setup@v3 # 如果使用 pnpm,请取消注释 | ||
# - uses: oven-sh/setup-bun@v1 # 如果使用 Bun,请取消注释 | ||
- name: Setup Node | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: 20 | ||
cache: npm # 或 pnpm / yarn | ||
- name: Setup Pages | ||
uses: actions/configure-pages@v4 | ||
- name: Install dependencies | ||
run: npm ci # 或 pnpm install / yarn install / bun install | ||
- name: Build with VitePress | ||
run: npm run docs:build # 或 pnpm docs:build / yarn docs:build / bun run docs:build | ||
- name: Upload artifact | ||
uses: actions/upload-pages-artifact@v3 | ||
with: | ||
path: .vitepress/dist | ||
|
||
# 部署工作 | ||
deploy: | ||
environment: | ||
name: github-pages | ||
url: ${{ steps.deployment.outputs.page_url }} | ||
needs: build | ||
runs-on: ubuntu-latest | ||
name: Deploy | ||
steps: | ||
- name: Deploy to GitHub Pages | ||
id: deployment | ||
uses: actions/deploy-pages@v4 |
This file contains 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,3 @@ | ||
node_modules | ||
.vitepress/cache/ | ||
.vitepress/dist/ |
This file contains 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,65 @@ | ||
import { defineConfig } from 'vitepress'; | ||
import { repo_name, repo_url } from './theme/params'; | ||
import footnote_plugin from 'markdown-it-footnote'; | ||
|
||
const tutorial_path = '/md/第一部分-基础知识/'; | ||
const homework_path = '/homework/08折叠表达式作业/'; | ||
|
||
// https://vitepress.dev/reference/site-config | ||
export default defineConfig({ | ||
title: "现代 C++ 模板教程", | ||
head: [['link', { rel: 'icon', href: repo_name + '/icon.webp' }]], | ||
rewrites: { 'README.md': 'index.md' }, | ||
base: repo_name + '/', | ||
themeConfig: { | ||
// https://vitepress.dev/reference/default-theme-config | ||
sidebar: [ | ||
{ | ||
items: [ | ||
{ text: '首页', link: '/' }, | ||
{ text: '阅读须知', link: '/md/README' }, | ||
{ text: '函数模板', link: tutorial_path + '01函数模板' }, | ||
{ text: '类模板', link: tutorial_path + '02类模板' }, | ||
{ text: '变量模板', link: tutorial_path + '03变量模板' }, | ||
{ text: '模板全特化', link: tutorial_path + '04模板全特化' }, | ||
{ text: '模板偏特化', link: tutorial_path + '05模板偏特化' }, | ||
{ text: '模板显式实例化解决模板分文件问题', link: tutorial_path + '06模板显式实例化解决模板分文件问题' }, | ||
{ text: '显式实例化解决模板导出静态动态库', link: tutorial_path + '07显式实例化解决模板导出静态动态库' }, | ||
{ text: '折叠表达式', link: tutorial_path + '08折叠表达式' }, | ||
{ text: '待决名', link: tutorial_path + '09待决名' }, | ||
{ text: '了解与利用SFINAE', link: tutorial_path + '10了解与利用SFINAE' }, | ||
{ text: '约束与概念', link: tutorial_path + '11约束与概念' }, | ||
{ | ||
text: '作业提交展示', | ||
collapsed: true, | ||
items: [ | ||
{ text: 'mq卢瑟', link: homework_path + 'mq卢瑟' }, | ||
{ text: 'roseveknif', link: homework_path + 'roseveknif' }, | ||
{ text: 'mq日', link: homework_path + 'mq日' }, | ||
{ text: 'saidfljwnzjasf', link: homework_path + 'saidfljwnzjasf' }, | ||
{ text: 'ooolize', link: homework_path + 'ooolize' }, | ||
] | ||
}, | ||
{ text: '总结', link: tutorial_path + '12总结' }, | ||
] | ||
}, | ||
], | ||
logo: '/icon.webp', | ||
editLink: { | ||
pattern: repo_url + 'blob/main/:path', | ||
text: '在 GitHub 上编辑此页面' | ||
}, | ||
socialLinks: [{ icon: 'github', link: repo_url }], | ||
|
||
outline: { label: '页面导航' }, | ||
returnToTopLabel: '回到顶端', | ||
}, | ||
markdown: { | ||
config(md) { | ||
md.use(footnote_plugin); | ||
} | ||
}, | ||
|
||
cleanUrls: true, | ||
ignoreDeadLinks: true, | ||
}) |
This file contains 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,14 @@ | ||
<template> | ||
<Layout> | ||
<template #not-found> | ||
<NotFound/> | ||
</template> | ||
</Layout> | ||
</template> | ||
|
||
<script setup> | ||
import DefaultTheme from 'vitepress/theme'; | ||
import NotFound from './NotFound.vue'; | ||
const { Layout } = DefaultTheme | ||
</script> |
This file contains 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,39 @@ | ||
<template> | ||
<div class="container"> | ||
<div class="head">跳转 GitHub 中...</div> | ||
<p>{{ decodeURI(to) }}</p> | ||
</div> | ||
</template> | ||
|
||
<script setup> | ||
import { useRouter, useData } from 'vitepress'; | ||
import { repo_name, repo_url } from './params'; | ||
const data = useData(); | ||
data.page.value.title = '跳转 GitHub 中...'; | ||
const router = useRouter(); | ||
const to = repo_url + 'blob/main' + router.route.path.substring(repo_name.length); | ||
console.log(to); | ||
location.replace(to); | ||
</script> | ||
|
||
<style scoped> | ||
.container { | ||
position: absolute; | ||
left: 50%; | ||
top: 50%; | ||
transform: translate(-50%, -100%); | ||
border: solid gray 1px; | ||
padding: 20px; | ||
border-radius: 5px; | ||
box-shadow: 0px 0px 1px; | ||
} | ||
.head { | ||
color: rgb(111, 111, 238); | ||
font-size: larger; | ||
font-weight: bolder; | ||
margin-bottom: 1em; | ||
} | ||
</style> |
This file contains 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,4 @@ | ||
.dark { | ||
--vp-c-bg: #1A1C20; | ||
/* --vp-c-bg-alt: #1A1C20; */ | ||
} |
This file contains 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,8 @@ | ||
import DefaultTheme from 'vitepress/theme'; | ||
import Layout from './Layout.vue'; | ||
import './index.css'; | ||
|
||
export default { | ||
extends: DefaultTheme, | ||
Layout, | ||
} |
This file contains 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,4 @@ | ||
const repo_name = '/Modern-Cpp-templates-tutorial'; | ||
const repo_url = `https://github.com/Mq-b${repo_name}/`; | ||
|
||
export {repo_url, repo_name} |
This file contains 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
This file contains 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
Oops, something went wrong.