Skip to content

Commit 488b090

Browse files
LessUpqwencoder
andcommitted
chore: 添加pre-commit配置和VitePress主题文件
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
1 parent 8e2a7c7 commit 488b090

2 files changed

Lines changed: 83 additions & 0 deletions

File tree

.pre-commit-config.yaml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# Pre-commit hooks for encoding project
2+
# Install: pip install pre-commit && pre-commit install
3+
# Run manually: pre-commit run --all-files
4+
5+
repos:
6+
# Go formatting
7+
- repo: https://github.com/pre-commit/pre-commit-hooks
8+
rev: v4.5.0
9+
hooks:
10+
- id: trailing-whitespace
11+
- id: end-of-file-fixer
12+
- id: check-yaml
13+
- id: check-added-large-files
14+
args: ['--maxkb=1000']
15+
16+
# Go formatting and linting
17+
- repo: https://github.com/TekWizely/pre-commit-golang
18+
rev: v1.0.0-rc.1
19+
hooks:
20+
- id: go-fmt
21+
files: \.go$
22+
- id: go-vet
23+
files: \.go$
24+
25+
# Rust formatting
26+
- repo: https://github.com/doublify/pre-commit-rust
27+
rev: v1.0
28+
hooks:
29+
- id: fmt
30+
files: \.rs$
31+
args: ['--check']
32+
33+
# Python
34+
- repo: https://github.com/psf/black
35+
rev: 24.1.1
36+
hooks:
37+
- id: black
38+
language_version: python3
39+
files: \.py$
40+
41+
# General checks
42+
- repo: https://github.com/pre-commit/pre-commit-hooks
43+
rev: v4.5.0
44+
hooks:
45+
- id: check-case-conflict
46+
- id: check-merge-conflict
47+
- id: detect-private-key

docs/.vitepress/theme/index.ts

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
import type { Theme } from 'vitepress'
2+
import DefaultTheme from 'vitepress/theme'
3+
import { h } from 'vue'
4+
import './styles/vars.css'
5+
import './styles/custom.css'
6+
import './styles/animations.css'
7+
import './styles/components.css'
8+
9+
// Import custom components
10+
import CustomFooter from './components/CustomFooter.vue'
11+
import AnimatedHero from './components/AnimatedHero.vue'
12+
import FeatureCard from './components/FeatureCard.vue'
13+
import AlgorithmShowcase from './components/AlgorithmShowcase.vue'
14+
import CodePlayground from './components/CodePlayground.vue'
15+
import LanguageSwitcher from './components/LanguageSwitcher.vue'
16+
import ReadingProgress from './components/ReadingProgress.vue'
17+
import BackToTop from './components/BackToTop.vue'
18+
19+
export default {
20+
extends: DefaultTheme,
21+
Layout: () => {
22+
return h(DefaultTheme.Layout, null, {
23+
'layout-bottom': () => h(CustomFooter),
24+
'doc-top': () => h(ReadingProgress),
25+
'doc-bottom': () => h(BackToTop),
26+
})
27+
},
28+
enhanceApp({ app }) {
29+
// Register custom components
30+
app.component('AnimatedHero', AnimatedHero)
31+
app.component('FeatureCard', FeatureCard)
32+
app.component('AlgorithmShowcase', AlgorithmShowcase)
33+
app.component('CodePlayground', CodePlayground)
34+
app.component('LanguageSwitcher', LanguageSwitcher)
35+
},
36+
} satisfies Theme

0 commit comments

Comments
 (0)