From 598d60ed21431558e8c930a0ba655fc47ab8e1e1 Mon Sep 17 00:00:00 2001 From: Mccree Lee <2935876049@qq.com> Date: Thu, 23 May 2024 22:49:17 +0800 Subject: [PATCH] docs: vitepress demo --- .github/workflows/docs.yml | 61 +++++++++++++++++++++++ docs/.gitignore | 6 +++ docs/docs/.vitepress/config.mts | 29 +++++++++++ docs/docs/api-examples.md | 49 +++++++++++++++++++ docs/docs/index.md | 46 ++++++++++++++++++ docs/docs/markdown-examples.md | 85 +++++++++++++++++++++++++++++++++ docs/package.json | 10 ++++ 7 files changed, 286 insertions(+) create mode 100644 .github/workflows/docs.yml create mode 100644 docs/.gitignore create mode 100644 docs/docs/.vitepress/config.mts create mode 100644 docs/docs/api-examples.md create mode 100644 docs/docs/index.md create mode 100644 docs/docs/markdown-examples.md create mode 100644 docs/package.json diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml new file mode 100644 index 000000000..58b39df0b --- /dev/null +++ b/.github/workflows/docs.yml @@ -0,0 +1,61 @@ +name: Documentation Deployment + +on: + push: + branches: + - main + +defaults: + run: + working-directory: ./docs + +jobs: + deploy-gh-pages: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Install Node.js + uses: actions/setup-node@v3 + with: + node-version: 16 + + - uses: pnpm/action-setup@v2 + name: Install pnpm + id: pnpm-install + with: + version: 7 + run_install: false + + - name: Get pnpm store directory + id: pnpm-cache + shell: bash + run: | + echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT + + - uses: actions/cache@v3 + name: Setup pnpm cache + with: + path: ${{ steps.pnpm-cache.outputs.STORE_PATH }} + key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} + restore-keys: | + ${{ runner.os }}-pnpm-store- + + - name: Install dependencies + run: pnpm install --no-frozen-lockfile + + - name: Build + env: + NODE_OPTIONS: --max_old_space_size=8192 + run: |- + pnpm run docs:build + > docs/.vitepress/dist/.nojekyll + + - name: Deployment + uses: JamesIves/github-pages-deploy-action@v4 + with: + branch: gh-pages + folder: docs/docs/.vitepress/dist \ No newline at end of file diff --git a/docs/.gitignore b/docs/.gitignore new file mode 100644 index 000000000..d1bb86d19 --- /dev/null +++ b/docs/.gitignore @@ -0,0 +1,6 @@ +node_modules +.DS_Store +cache +temp +dist +pnpm-lock.yaml \ No newline at end of file diff --git a/docs/docs/.vitepress/config.mts b/docs/docs/.vitepress/config.mts new file mode 100644 index 000000000..b31d45477 --- /dev/null +++ b/docs/docs/.vitepress/config.mts @@ -0,0 +1,29 @@ +import { defineConfig } from 'vitepress' + +// https://vitepress.dev/reference/site-config +export default defineConfig({ + base: '/SukiUI/', + title: "SukiUI", + description: "A VitePress Site", + themeConfig: { + // https://vitepress.dev/reference/default-theme-config + nav: [ + { text: 'Home', link: '/' }, + { text: 'Examples', link: '/markdown-examples' } + ], + + sidebar: [ + { + text: 'Examples', + items: [ + { text: 'Markdown Examples', link: '/markdown-examples' }, + { text: 'Runtime API Examples', link: '/api-examples' } + ] + } + ], + + socialLinks: [ + { icon: 'github', link: 'https://github.com/vuejs/vitepress' } + ] + } +}) diff --git a/docs/docs/api-examples.md b/docs/docs/api-examples.md new file mode 100644 index 000000000..6bd8bb5c1 --- /dev/null +++ b/docs/docs/api-examples.md @@ -0,0 +1,49 @@ +--- +outline: deep +--- + +# Runtime API Examples + +This page demonstrates usage of some of the runtime APIs provided by VitePress. + +The main `useData()` API can be used to access site, theme, and page data for the current page. It works in both `.md` and `.vue` files: + +```md + + +## Results + +### Theme Data +
{{ theme }}+ +### Page Data +
{{ page }}+ +### Page Frontmatter +
{{ frontmatter }}+``` + + + +## Results + +### Theme Data +
{{ theme }}+ +### Page Data +
{{ page }}+ +### Page Frontmatter +
{{ frontmatter }}+ +## More + +Check out the documentation for the [full list of runtime APIs](https://vitepress.dev/reference/runtime-api#usedata). diff --git a/docs/docs/index.md b/docs/docs/index.md new file mode 100644 index 000000000..2c56e574c --- /dev/null +++ b/docs/docs/index.md @@ -0,0 +1,46 @@ +--- +# https://vitepress.dev/reference/default-theme-home-page +layout: home + +hero: + name: "SukiUI" + text: "A Desktop UI Library for Avalonia" + tagline: Modern, Simple, Animated + actions: + - theme: brand + text: Get Started + link: /markdown-examples + - theme: alt + text: Documentation + link: /api-examples + image: + src: https://raw.githubusercontent.com/kikipoulet/SukiUI/main/Images/OIG.N5o-removebg-preview.png + alt: SukiUILogo + +features: + - title: Feature A + details: Lorem ipsum dolor sit amet, consectetur adipiscing elit + - title: Feature B + details: Lorem ipsum dolor sit amet, consectetur adipiscing elit + - title: Feature C + details: Lorem ipsum dolor sit amet, consectetur adipiscing elit +--- + + \ No newline at end of file diff --git a/docs/docs/markdown-examples.md b/docs/docs/markdown-examples.md new file mode 100644 index 000000000..f9258a550 --- /dev/null +++ b/docs/docs/markdown-examples.md @@ -0,0 +1,85 @@ +# Markdown Extension Examples + +This page demonstrates some of the built-in markdown extensions provided by VitePress. + +## Syntax Highlighting + +VitePress provides Syntax Highlighting powered by [Shiki](https://github.com/shikijs/shiki), with additional features like line-highlighting: + +**Input** + +````md +```js{4} +export default { + data () { + return { + msg: 'Highlighted!' + } + } +} +``` +```` + +**Output** + +```js{4} +export default { + data () { + return { + msg: 'Highlighted!' + } + } +} +``` + +## Custom Containers + +**Input** + +```md +::: info +This is an info box. +::: + +::: tip +This is a tip. +::: + +::: warning +This is a warning. +::: + +::: danger +This is a dangerous warning. +::: + +::: details +This is a details block. +::: +``` + +**Output** + +::: info +This is an info box. +::: + +::: tip +This is a tip. +::: + +::: warning +This is a warning. +::: + +::: danger +This is a dangerous warning. +::: + +::: details +This is a details block. +::: + +## More + +Check out the documentation for the [full list of markdown extensions](https://vitepress.dev/guide/markdown). diff --git a/docs/package.json b/docs/package.json new file mode 100644 index 000000000..fc84eff8a --- /dev/null +++ b/docs/package.json @@ -0,0 +1,10 @@ +{ + "devDependencies": { + "vitepress": "^1.2.2" + }, + "scripts": { + "docs:dev": "vitepress dev docs", + "docs:build": "vitepress build docs", + "docs:preview": "vitepress preview docs" + } +} \ No newline at end of file