Skip to content

Commit

Permalink
repo init
Browse files Browse the repository at this point in the history
  • Loading branch information
upcloudrabbit committed Feb 10, 2025
1 parent dd7c737 commit 11f4dc6
Show file tree
Hide file tree
Showing 21 changed files with 11,046 additions and 0 deletions.
10 changes: 10 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
* text eol=lf
*.txt text eol=crlf

*.png binary
*.jpg binary
*.jpeg binary
*.ico binary
*.tff binary
*.woff binary
*.woff2 binary
53 changes: 53 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: deploy

on:
# 每当 push 到 main 分支时触发部署
# Deployment is triggered whenever a push is made to the main branch.
push:
branches: [main]
# 手动触发部署
# Manually trigger deployment
workflow_dispatch:

jobs:
docs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
with:
# “最近更新时间” 等 git 日志相关信息,需要拉取全部提交记录
# "Last updated time" and other git log-related information require fetching all commit records.
fetch-depth: 0

- name: Setup Node.js
uses: actions/setup-node@v4
with:
# 选择要使用的 node 版本
node-version: 20

# 安装依赖
# Install dependencies
- name: Install Dependencies
run: npm ci



# 运行构建脚本
# Run the build script
- name: Build VuePress site
run: npm run docs:build


# 查看 workflow 的文档来获取更多信息
# @see https://github.com/crazy-max/ghaction-github-pages
- name: Deploy to GitHub Pages
uses: crazy-max/ghaction-github-pages@v4
with:
# 部署到 gh-pages 分支
target_branch: gh-pages
# 部署目录为 VuePress 的默认输出目录
build_dir: docs/.vuepress/dist
env:
# @see https://docs.github.com/cn/actions/reference/authentication-in-a-workflow#about-the-github_token-secret
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
**/node_modules

docs/.vuepress/.cache
docs/.vuepress/.temp
docs/.vuepress/dist

.DS_Store
*.log
.idea
42 changes: 42 additions & 0 deletions README.zh-CN.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# lhc-s-blog

网站使用 [vuepress](https://vuepress.vuejs.org/)[vuepress-theme-plume](https://github.com/pengzhanbo/vuepress-theme-plume) 构建生成。

## Install

```sh
npm i
```

## Usage

```sh
# 启动开发服务
npm run docs:dev
# 构建生产包
npm run docs:build
# 本地预览生产服务
npm run docs:preview
# 更新 vuepress 和主题
npm run vp-update
```

## 部署到 GitHub Pages

主题已创建 github actions: `.github/workflows/docs-deploy.yml`,你还需要在 github 仓库中进行以下设置:

- [ ] `settings > Actions > General`,拉到页面底部,在 `Workflow permissions` 下,勾选 `Read and write permissions`,并点击保存按钮

- [ ] `settings > Pages`, 在 `Build and deployment` 中,`Source` 选择 `Deploy from a branch`, `Branch` 选择 `gh-pages`,并点击保存按钮
(首次创建可能没有 `gh-pages`分支,你可以先完成上面的设置后,推送一次代码到主分支,等待 `github actions` 完成后再进行设置)

- [ ] 修改 `docs/.vuepress/config.ts` 中的 `base` 选项:
- 如果你准备发布到 `https://<USERNAME>.github.io/` ,你可以省略这一步,因为 `base` 默认就是 `"/"`
- 如果你准备发布到 `https://<USERNAME>.github.io/<REPO>/` ,也就是说你的仓库地址是 `https://github.com/<USERNAME>/<REPO>` ,则将 `base` 设置为 `"/<REPO>/"`

如需要自定义域名,请查看 [Github Pages 文档](https://docs.github.com/zh/pages/configuring-a-custom-domain-for-your-github-pages-site/about-custom-domains-and-github-pages)

## 文档

- [vuepress](https://vuepress.vuejs.org/)
- [vuepress-theme-plume](https://theme-plume.vuejs.press/)
22 changes: 22 additions & 0 deletions docs/.vuepress/client.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { defineClientConfig } from 'vuepress/client'
// import RepoCard from 'vuepress-theme-plume/features/RepoCard.vue'
// import NpmBadge from 'vuepress-theme-plume/features/NpmBadge.vue'
// import NpmBadgeGroup from 'vuepress-theme-plume/features/NpmBadgeGroup.vue'
// import Swiper from 'vuepress-theme-plume/features/Swiper.vue'

// import CustomComponent from './theme/components/Custom.vue'

// import './theme/styles/custom.css'

export default defineClientConfig({
enhance({ app }) {
// built-in components
// app.component('RepoCard', RepoCard)
// app.component('NpmBadge', NpmBadge)
// app.component('NpmBadgeGroup', NpmBadgeGroup)
// app.component('Swiper', Swiper) // you should install `swiper`

// your custom components
// app.component('CustomComponent', CustomComponent)
},
})
178 changes: 178 additions & 0 deletions docs/.vuepress/config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,178 @@
import { viteBundler } from '@vuepress/bundler-vite'
import { defineUserConfig } from 'vuepress'
import { plumeTheme } from 'vuepress-theme-plume'

export default defineUserConfig({
base: '/',
lang: 'zh-CN',
title: 'upcloudrabbit blog',
description: 'a private blog website',

head: [
// 配置站点图标
['link', { rel: 'icon', type: 'image/png', href: 'https://theme-plume.vuejs.press/favicon-32x32.png' }],
],

bundler: viteBundler(),
shouldPrefetch: false, // 站点较大,页面数量较多时,不建议启用

theme: plumeTheme({
/* 添加您的部署域名, 有助于 SEO, 生成 sitemap */
// hostname: 'https://your_site_url',

/* 文档仓库配置,用于 editLink */
// docsRepo: '',
// docsDir: 'docs',
// docsBranch: '',

/* 页内信息 */
// editLink: true,
lastUpdated: true,
// contributors: true,
// changelog: false,

/**
* 博客
* @see https://theme-plume.vuejs.press/config/basic/#blog
*/
// blog: false, // 禁用博客
// blog: {
// postList: true, // 是否启用文章列表页
// tags: true, // 是否启用标签页
// archives: true, // 是否启用归档页
// categories: true, // 是否启用分类页
// postCover: 'right', // 文章封面位置
// pagination: 15, // 每页显示文章数量
// },

/* 博客文章页面链接前缀 */
article: '/article/',

/**
* 编译缓存,加快编译速度
* @see https://theme-plume.vuejs.press/config/basic/#cache
*/
cache: 'filesystem',

/**
* 为 markdown 文件自动添加 frontmatter 配置
* @see https://theme-plume.vuejs.press/config/basic/#autofrontmatter
*/
// autoFrontmatter: {
// permalink: true, // 是否生成永久链接
// createTime: true, // 是否生成创建时间
// title: true, // 是否生成标题
// },

plugins: {
/**
* Shiki 代码高亮
* @see https://theme-plume.vuejs.press/config/plugins/code-highlight/
*/
// shiki: {
// // 强烈建议预设代码块高亮语言,插件默认加载所有语言会产生不必要的时间开销
// languages: ['shell', 'bash', 'typescript', 'javascript'],
// twoslash: true, // 启用 twoslash
// whitespace: true, // 启用 空格/Tab 高亮
// lineNumbers: true, // 启用行号
// },

/* 本地搜索, 默认启用 */
// search: true,

/**
* Algolia DocSearch
* 启用此搜索需要将 本地搜索 search 设置为 false
* @see https://theme-plume.vuejs.press/config/plugins/search/#algolia-docsearch
*/
// docsearch: {
// appId: '',
// apiKey: '',
// indexName: '',
// },

/* 文章字数统计、阅读时间,设置为 false 则禁用 */
// readingTime: true,

/**
* markdown enhance
* @see https://theme-plume.vuejs.press/config/plugins/markdown-enhance/
*/
// markdownEnhance: {
// chartjs: true,
// echarts: true,
// mermaid: true,
// flowchart: true,
// },

/**
* markdown power
* @see https://theme-plume.vuejs.press/config/plugin/markdown-power/
*/
// markdownPower: {
// pdf: true, // 启用 PDF 嵌入 @[pdf](/xxx.pdf)
// caniuse: true, // 启用 caniuse 语法 @[caniuse](feature_name)
// plot: true, // 启用隐秘文本语法 !!xxxx!!
// bilibili: true, // 启用嵌入 bilibili视频 语法 @[bilibili](bid)
// youtube: true, // 启用嵌入 youtube视频 语法 @[youtube](video_id)
// artPlayer: true, // 启用嵌入 artPlayer 本地视频 语法 @[artPlayer](url)
// audioReader: true, // 启用嵌入音频朗读功能 语法 @[audioReader](url)
// icons: true, // 启用内置图标语法 :[icon-name]:
// codepen: true, // 启用嵌入 codepen 语法 @[codepen](user/slash)
// replit: true, // 启用嵌入 replit 语法 @[replit](user/repl-name)
// codeSandbox: true, // 启用嵌入 codeSandbox 语法 @[codeSandbox](id)
// jsfiddle: true, // 启用嵌入 jsfiddle 语法 @[jsfiddle](user/id)
// npmTo: true, // 启用 npm-to 容器 ::: npm-to
// demo: true, // 启用 demo 容器 ::: demo
// repl: { // 启用 代码演示容器
// go: true, // ::: go-repl
// rust: true, // ::: rust-repl
// kotlin: true, // ::: kotlin-repl
// },
// imageSize: 'local', // 启用 自动填充 图片宽高属性,避免页面抖动
// },

/**
* 在 Markdown 文件中导入其他 markdown 文件内容。
* @see https://theme-plume.vuejs.press/guide/markdown/include/
*/
// markdownInclude: true,

/**
* Markdown 数学公式
* @see https://theme-plume.vuejs.press/config/plugins/markdown-math/
*/
// markdownMath: {
// type: 'katex',
// },

/**
* 水印
* @see https://theme-plume.vuejs.press/guide/features/watermark/
*/
// watermark: true,

/**
* 评论 comments
* @see https://theme-plume.vuejs.press/guide/features/comments/
*/
// comment: {
// provider: '', // "Artalk" | "Giscus" | "Twikoo" | "Waline"
// comment: true,
// repo: '',
// repoId: '',
// category: '',
// categoryId: '',
// mapping: 'pathname',
// reactionsEnabled: true,
// inputPosition: 'top',
// },
},

/**
* 加密功能
* @see https://theme-plume.vuejs.press/guide/features/encryption/
*/
// encrypt: {},
}),
})
12 changes: 12 additions & 0 deletions docs/.vuepress/navbar.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { defineNavbarConfig } from 'vuepress-theme-plume'

export const navbar = defineNavbarConfig([
{ text: '首页', link: '/' },
{ text: '博客', link: '/blog/' },
{ text: '标签', link: '/blog/tags/' },
{ text: '归档', link: '/blog/archives/' },
{
text: '笔记',
items: [{ text: '示例', link: '/notes/demo/README.md' }]
},
])
13 changes: 13 additions & 0 deletions docs/.vuepress/notes.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { defineNoteConfig, defineNotesConfig } from 'vuepress-theme-plume'

const demoNote = defineNoteConfig({
dir: 'demo',
link: '/demo',
sidebar: ['', 'foo', 'bar'],
})

export const notes = defineNotesConfig({
dir: 'notes',
link: '/',
notes: [demoNote],
})
Loading

0 comments on commit 11f4dc6

Please sign in to comment.