Skip to content

Commit

Permalink
feat: use theme-hope
Browse files Browse the repository at this point in the history
  • Loading branch information
Mister-Hope committed Dec 4, 2023
1 parent 27fa9a2 commit 4ffc338
Show file tree
Hide file tree
Showing 96 changed files with 2,134 additions and 593 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/deploy-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Deploy docs

on:
push:
branches:
- theme-hope

jobs:
deploy-netlify:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Install pnpm
uses: pnpm/action-setup@v2
with:
run_install: true

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

- name: Build docs
env:
NODE_OPTIONS: --max_old_space_size=4096
run: |-
pnpm run docs:build
> docs/.vuepress/dist/.nojekyll
- name: Deploy docs
uses: JamesIves/github-pages-deploy-action@v4
with:
branch: netlify
folder: docs/.vuepress/dist
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,6 @@
"vuepress",
"vueuse",
"zoomable"
]
],
"markdown.extension.toc.updateOnSave": false
}
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@

VuePress documentation repository.

This branch holds a VuePress2 official docs powered by [VuePress Theme Hope](https://theme-hope.vuejs.press).

## Deployments

- Release deployment: https://v2.vuepress.vuejs.org
- Developer deployment: https://vuepress.github.io
- Deployment: <https://vuejs.press>

## License

Expand Down
86 changes: 4 additions & 82 deletions docs/.vuepress/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,13 @@ import { viteBundler } from '@vuepress/bundler-vite'
import { webpackBundler } from '@vuepress/bundler-webpack'
import { defineUserConfig } from '@vuepress/cli'
import { docsearchPlugin } from '@vuepress/plugin-docsearch'
import { googleAnalyticsPlugin } from '@vuepress/plugin-google-analytics'
import { registerComponentsPlugin } from '@vuepress/plugin-register-components'
import { shikiPlugin } from '@vuepress/plugin-shiki'
import { defaultTheme } from '@vuepress/theme-default'
import { getDirname, path } from '@vuepress/utils'
import {
head,
navbarEn,
navbarZh,
sidebarEn,
sidebarZh,
} from './configs/index.js'
import { head } from './configs/index.js'
import theme from './theme.js'

const __dirname = getDirname(import.meta.url)
const require = createRequire(import.meta.url)
const isProd = process.env.NODE_ENV === 'production'

export default defineUserConfig({
// set site base to default value
Expand All @@ -46,71 +37,6 @@ export default defineUserConfig({
bundler:
process.env.DOCS_BUNDLER === 'webpack' ? webpackBundler() : viteBundler(),

// configure default theme
theme: defaultTheme({
logo: '/images/hero.png',
repo: 'vuepress/vuepress-next',
docsDir: 'docs',

// theme-level locales config
locales: {
/**
* English locale config
*
* As the default locale of @vuepress/theme-default is English,
* we don't need to set all of the locale fields
*/
'/': {
// navbar
navbar: navbarEn,
// sidebar
sidebar: sidebarEn,
// page meta
editLinkText: 'Edit this page on GitHub',
},

/**
* Chinese locale config
*/
'/zh/': {
// navbar
navbar: navbarZh,
selectLanguageName: '简体中文',
selectLanguageText: '选择语言',
selectLanguageAriaLabel: '选择语言',
// sidebar
sidebar: sidebarZh,
// page meta
editLinkText: '在 GitHub 上编辑此页',
lastUpdatedText: '上次更新',
contributorsText: '贡献者',
// custom containers
tip: '提示',
warning: '注意',
danger: '警告',
// 404 page
notFound: [
'这里什么都没有',
'我们怎么到这来了?',
'这是一个 404 页面',
'看起来我们进入了错误的链接',
],
backToHome: '返回首页',
// a11y
openInNewWindow: '在新窗口打开',
toggleColorMode: '切换颜色模式',
toggleSidebar: '切换侧边栏',
},
},

themePlugins: {
// only enable git plugin in production mode
git: isProd,
// use shiki plugin in production mode instead
prismjs: !isProd,
},
}),

// configure markdown
markdown: {
importCode: {
Expand All @@ -131,6 +57,8 @@ export default defineUserConfig({
},
},

theme,

// use plugins
plugins: [
docsearchPlugin({
Expand Down Expand Up @@ -184,14 +112,8 @@ export default defineUserConfig({
},
},
}),
googleAnalyticsPlugin({
// we have multiple deployments, which would use different id
id: process.env.DOCS_GA_ID ?? '',
}),
registerComponentsPlugin({
componentsDir: path.resolve(__dirname, './components'),
}),
// only enable shiki plugin in production mode
isProd ? shikiPlugin({ theme: 'dark-plus' }) : [],
],
})
104 changes: 55 additions & 49 deletions docs/.vuepress/configs/navbar/en.ts
Original file line number Diff line number Diff line change
@@ -1,110 +1,108 @@
import type { NavbarConfig } from '@vuepress/theme-default'
import { navbar } from 'vuepress-theme-hope'
import { version } from '../meta.js'

export const navbarEn: NavbarConfig = [
export const enNavbar = navbar([
{
text: 'Guide',
icon: 'fa6-solid:lightbulb',
link: '/guide/',
},
{
text: 'Reference',
icon: 'fa6-solid:book',
prefix: '/reference/',
children: [
{
text: 'VuePress',
children: [
{
text: 'CLI',
link: '/reference/cli.html',
icon: 'bi:terminal-fill',
link: 'cli.html',
},
'/reference/config.md',
'/reference/frontmatter.md',
'/reference/components.md',
'/reference/plugin-api.md',
'/reference/theme-api.md',
'/reference/client-api.md',
'/reference/node-api.md',
'config',
'frontmatter',
'components',
'plugin-api',
'theme-api',
'client-api',
'node-api',
],
},
{
text: 'Bundlers',
children: [
'/reference/bundler/vite.md',
'/reference/bundler/webpack.md',
],
prefix: 'bundler/',
children: ['vite', 'webpack'],
},
{
text: 'Default Theme',
prefix: 'default-theme/',
children: [
'/reference/default-theme/config.md',
'/reference/default-theme/frontmatter.md',
'/reference/default-theme/components.md',
'/reference/default-theme/markdown.md',
'/reference/default-theme/styles.md',
'/reference/default-theme/extending.md',
'config',
'frontmatter',
'components',
'markdown',
'styles',
'extending',
],
},
],
},
{
text: 'Plugins',
icon: 'fa6-solid:plug',
prefix: '/reference/plugin/',
children: [
{
text: 'Common Features',
children: [
'/reference/plugin/back-to-top.md',
'/reference/plugin/container.md',
'/reference/plugin/external-link-icon.md',
'/reference/plugin/google-analytics.md',
'/reference/plugin/medium-zoom.md',
'/reference/plugin/nprogress.md',
'/reference/plugin/register-components.md',
'back-to-top',
'container',
'external-link-icon',
'google-analytics',
'medium-zoom',
'nprogress',
'register-components',
],
},
{
text: 'Content Search',
children: [
'/reference/plugin/docsearch.md',
'/reference/plugin/search.md',
],
children: ['docsearch', 'search'],
},
{
text: 'PWA',
children: [
'/reference/plugin/pwa.md',
'/reference/plugin/pwa-popup.md',
],
children: ['pwa', 'pwa-popup'],
},
{
text: 'Syntax Highlighting',
children: [
'/reference/plugin/prismjs.md',
'/reference/plugin/shiki.md',
],
children: ['prismjs', 'shiki'],
},
{
text: 'Theme Development',
children: [
'/reference/plugin/active-header-links.md',
'/reference/plugin/git.md',
'/reference/plugin/palette.md',
'/reference/plugin/theme-data.md',
'/reference/plugin/toc.md',
'active-header-links',
'git',
'palette',
'theme-data',
'toc',
],
},
],
},
{
text: 'Learn More',
icon: 'fa6-solid:feather',
children: [
{
text: 'Advanced',
prefix: '/advanced/',
children: [
'/advanced/architecture.md',
'/advanced/plugin.md',
'/advanced/theme.md',
'architecture',
'plugin',
'theme',
{
text: 'Cookbook',
link: '/advanced/cookbook/',
link: 'cookbook/',
},
],
},
Expand All @@ -119,25 +117,33 @@ export const navbarEn: NavbarConfig = [
text: 'Awesome VuePress',
link: 'https://github.com/vuepress/awesome-vuepress',
},
{
text: 'VuePress MarketPlace',
link: 'https://marketplace.vuejs.press',
},
],
},
],
},
{
text: `v${version}`,
icon: 'fa6-solid:tag',
children: [
{
text: 'Changelog',
icon: 'fa6-solid:clock',
link: 'https://github.com/vuepress/vuepress-next/blob/main/CHANGELOG.md',
},
{
text: 'v1.x',
icon: 'fa6-brands:vuejs',
link: 'https://v1.vuepress.vuejs.org',
},
{
text: 'v0.x',
icon: 'fa6-brands:vuejs',
link: 'https://v0.vuepress.vuejs.org',
},
],
},
]
])
Loading

0 comments on commit 4ffc338

Please sign in to comment.