-
-
Notifications
You must be signed in to change notification settings - Fork 40.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Vitepress conversion of docs. (#23795)
- Loading branch information
Showing
357 changed files
with
3,611 additions
and
24,208 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 |
---|---|---|
|
@@ -7,20 +7,26 @@ on: | |
push: | ||
branches: | ||
- master | ||
- vitepress | ||
paths: | ||
- 'builddefs/docsgen/**' | ||
- 'tmk_core/**' | ||
- 'quantum/**' | ||
- 'platforms/**' | ||
- 'docs/**' | ||
- '.github/workflows/docs.yml' | ||
|
||
defaults: | ||
run: | ||
shell: bash | ||
|
||
jobs: | ||
generate: | ||
runs-on: ubuntu-latest | ||
container: ghcr.io/qmk/qmk_cli | ||
|
||
# protect against those who develop with their fork on master | ||
if: github.repository == 'qmk/qmk_firmware' | ||
if: github.repository == 'qmk/qmk_firmware' || (github.repository == 'tzarc/qmk_firmware' && github.ref == 'refs/heads/vitepress') | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
@@ -29,18 +35,51 @@ jobs: | |
|
||
- name: Install dependencies | ||
run: | | ||
apt-get update && apt-get install -y rsync nodejs npm doxygen | ||
apt-get update && apt-get install -y rsync doxygen curl | ||
# install nvm | ||
touch $HOME/.bashrc | ||
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash | ||
- name: Install node | ||
run: | | ||
source $HOME/.bashrc | ||
nvm install 20 | ||
nvm use 20 | ||
corepack enable | ||
npm install -g moxygen | ||
- name: Build docs | ||
run: | | ||
source $HOME/.bashrc | ||
nvm use 20 | ||
qmk --verbose generate-docs | ||
touch '.build/docs/.nojekyll' | ||
- name: Set CNAME | ||
if: github.repository == 'qmk/qmk_firmware' | ||
run: | | ||
# Override target CNAME | ||
echo 'docs.qmk.fm' > .build/docs/CNAME | ||
- name: Override CNAME | ||
if: github.repository == 'tzarc/qmk_firmware' | ||
run: | | ||
# Temporarily override target CNAME during development | ||
echo 'vitepress.qmk.fm' > .build/docs/CNAME | ||
- name: Deploy | ||
if: github.repository == 'qmk/qmk_firmware' | ||
uses: JamesIves/[email protected] | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
branch: gh-pages | ||
folder: .build/docs | ||
git-config-name: QMK Bot | ||
git-config-email: [email protected] | ||
|
||
- name: Deploy | ||
if: github.repository == 'tzarc/qmk_firmware' | ||
uses: JamesIves/[email protected] | ||
with: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
BASE_BRANCH: master | ||
BRANCH: gh-pages | ||
FOLDER: .build/docs | ||
GIT_CONFIG_EMAIL: [email protected] | ||
branch: gh-pages | ||
folder: .build/docs |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
node_modules | ||
.vitepress/cache | ||
.vitepress/.temp | ||
.vitepress/dist | ||
docs |
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,51 @@ | ||
import { defineConfig } from "vitepress"; | ||
import { tabsMarkdownPlugin } from "vitepress-plugin-tabs"; | ||
import sidebar from "../../../docs/_sidebar.json"; | ||
|
||
// https://vitepress.dev/reference/site-config | ||
export default defineConfig(({ mode }) => { | ||
const prod = mode === "production"; | ||
return { | ||
title: "QMK Firmware", | ||
description: "Documentation for QMK Firmware", | ||
|
||
srcDir: prod ? "docs" : "../../docs", | ||
outDir: "../../.build/docs", | ||
cleanUrls: true, | ||
|
||
markdown: { | ||
config(md) { | ||
md.use(tabsMarkdownPlugin); | ||
}, | ||
}, | ||
|
||
vite: { | ||
resolve: { | ||
preserveSymlinks: true, | ||
}, | ||
}, | ||
|
||
themeConfig: { | ||
// https://vitepress.dev/reference/default-theme-config | ||
logo: { | ||
light: "/badge-community-light.svg", | ||
dark: "/badge-community-dark.svg", | ||
}, | ||
siteTitle: false, | ||
|
||
nav: [{ text: "Home", link: "./" }], | ||
|
||
search: { | ||
provider: "local", | ||
}, | ||
|
||
sidebar: sidebar, | ||
|
||
socialLinks: [ | ||
{ icon: { svg: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 50 50" width="50px" height="50px"><path d="M 29 3 C 28.0625 3 27.164063 3.382813 26.5 4 C 25.835938 4.617188 25.363281 5.433594 25 6.40625 C 24.355469 8.140625 24.085938 10.394531 24.03125 13.03125 C 19.234375 13.179688 14.820313 14.421875 11.28125 16.46875 C 10.214844 15.46875 8.855469 14.96875 7.5 14.96875 C 6.089844 14.96875 4.675781 15.511719 3.59375 16.59375 C 1.425781 18.761719 1.425781 22.238281 3.59375 24.40625 L 3.84375 24.65625 C 3.3125 26.035156 3 27.488281 3 29 C 3 33.527344 5.566406 37.585938 9.5625 40.4375 C 13.558594 43.289063 19.007813 45 25 45 C 30.992188 45 36.441406 43.289063 40.4375 40.4375 C 44.433594 37.585938 47 33.527344 47 29 C 47 27.488281 46.6875 26.035156 46.15625 24.65625 L 46.40625 24.40625 C 48.574219 22.238281 48.574219 18.761719 46.40625 16.59375 C 45.324219 15.511719 43.910156 14.96875 42.5 14.96875 C 41.144531 14.96875 39.785156 15.46875 38.71875 16.46875 C 35.195313 14.433594 30.800781 13.191406 26.03125 13.03125 C 26.09375 10.546875 26.363281 8.46875 26.875 7.09375 C 27.164063 6.316406 27.527344 5.757813 27.875 5.4375 C 28.222656 5.117188 28.539063 5 29 5 C 29.460938 5 29.683594 5.125 30.03125 5.40625 C 30.378906 5.6875 30.785156 6.148438 31.3125 6.6875 C 32.253906 7.652344 33.695313 8.714844 36.09375 8.9375 C 36.539063 11.238281 38.574219 13 41 13 C 43.75 13 46 10.75 46 8 C 46 5.25 43.75 3 41 3 C 38.605469 3 36.574219 4.710938 36.09375 6.96875 C 34.3125 6.796875 33.527344 6.109375 32.75 5.3125 C 32.300781 4.851563 31.886719 4.3125 31.3125 3.84375 C 30.738281 3.375 29.9375 3 29 3 Z M 41 5 C 42.667969 5 44 6.332031 44 8 C 44 9.667969 42.667969 11 41 11 C 39.332031 11 38 9.667969 38 8 C 38 6.332031 39.332031 5 41 5 Z M 25 15 C 30.609375 15 35.675781 16.613281 39.28125 19.1875 C 42.886719 21.761719 45 25.226563 45 29 C 45 32.773438 42.886719 36.238281 39.28125 38.8125 C 35.675781 41.386719 30.609375 43 25 43 C 19.390625 43 14.324219 41.386719 10.71875 38.8125 C 7.113281 36.238281 5 32.773438 5 29 C 5 25.226563 7.113281 21.761719 10.71875 19.1875 C 14.324219 16.613281 19.390625 15 25 15 Z M 7.5 16.9375 C 8.203125 16.9375 8.914063 17.148438 9.53125 17.59375 C 7.527344 19.03125 5.886719 20.769531 4.75 22.71875 C 3.582031 21.296875 3.660156 19.339844 5 18 C 5.714844 17.285156 6.609375 16.9375 7.5 16.9375 Z M 42.5 16.9375 C 43.390625 16.9375 44.285156 17.285156 45 18 C 46.339844 19.339844 46.417969 21.296875 45.25 22.71875 C 44.113281 20.769531 42.472656 19.03125 40.46875 17.59375 C 41.085938 17.148438 41.796875 16.9375 42.5 16.9375 Z M 17 22 C 14.800781 22 13 23.800781 13 26 C 13 28.199219 14.800781 30 17 30 C 19.199219 30 21 28.199219 21 26 C 21 23.800781 19.199219 22 17 22 Z M 33 22 C 30.800781 22 29 23.800781 29 26 C 29 28.199219 30.800781 30 33 30 C 35.199219 30 37 28.199219 37 26 C 37 23.800781 35.199219 22 33 22 Z M 17 24 C 18.117188 24 19 24.882813 19 26 C 19 27.117188 18.117188 28 17 28 C 15.882813 28 15 27.117188 15 26 C 15 24.882813 15.882813 24 17 24 Z M 33 24 C 34.117188 24 35 24.882813 35 26 C 35 27.117188 34.117188 28 33 28 C 31.882813 28 31 27.117188 31 26 C 31 24.882813 31.882813 24 33 24 Z M 34.15625 33.84375 C 34.101563 33.851563 34.050781 33.859375 34 33.875 C 33.683594 33.9375 33.417969 34.144531 33.28125 34.4375 C 33.28125 34.4375 32.757813 35.164063 31.4375 36 C 30.117188 36.835938 28.058594 37.6875 25 37.6875 C 21.941406 37.6875 19.882813 36.835938 18.5625 36 C 17.242188 35.164063 16.71875 34.4375 16.71875 34.4375 C 16.492188 34.082031 16.066406 33.90625 15.65625 34 C 15.332031 34.082031 15.070313 34.316406 14.957031 34.632813 C 14.84375 34.945313 14.894531 35.292969 15.09375 35.5625 C 15.09375 35.5625 15.863281 36.671875 17.46875 37.6875 C 19.074219 38.703125 21.558594 39.6875 25 39.6875 C 28.441406 39.6875 30.925781 38.703125 32.53125 37.6875 C 34.136719 36.671875 34.90625 35.5625 34.90625 35.5625 C 35.207031 35.273438 35.296875 34.824219 35.128906 34.441406 C 34.960938 34.058594 34.574219 33.820313 34.15625 33.84375 Z"/></svg>' }, link: "https://reddit.com/r/olkb" }, | ||
{ icon: "discord", link: "https://discord.gg/qmk" }, | ||
{ icon: "github", link: "https://github.com/qmk/qmk_firmware" }, | ||
], | ||
} | ||
}; | ||
}); |
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,18 @@ | ||
<script setup> | ||
import DefaultTheme from 'vitepress/theme' | ||
import { useRouter } from 'vitepress' | ||
import { onBeforeMount } from 'vue'; | ||
const router = useRouter() | ||
onBeforeMount(async () => { | ||
if (window.location.href.includes('/#/')) { | ||
const newUrl = window.location.href.replace(/\/#\//, '/').replace(/\?id=/, '#'); | ||
window.history.replaceState({}, '', newUrl); | ||
await router.go(newUrl); | ||
} | ||
}); | ||
</script> | ||
|
||
<template> | ||
<DefaultTheme.Layout/> | ||
</template> |
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,19 @@ | ||
/* Override <kbd> as vitepress doesn't put them with borders */ | ||
kbd { | ||
border: 1px solid var(--vp-c-text-1); | ||
border-radius: 0.6em; | ||
margin: 0.2em; | ||
padding: 0.2em; | ||
} | ||
|
||
:root { | ||
--vp-nav-logo-height: 100%; | ||
} | ||
|
||
.logo { | ||
padding-bottom: 0.2em; | ||
} | ||
|
||
.VPNavBarTitle.has-sidebar .title { | ||
border-bottom: 0; | ||
} |
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,13 @@ | ||
import type { Theme } from 'vitepress' | ||
import DefaultTheme from 'vitepress/theme' | ||
import { enhanceAppWithTabs } from 'vitepress-plugin-tabs/client' | ||
import QMKLayout from './QMKLayout.vue' | ||
import './custom.css' | ||
|
||
export default { | ||
extends: DefaultTheme, | ||
Layout: QMKLayout, | ||
enhanceApp({ app }) { | ||
enhanceAppWithTabs(app) | ||
} | ||
} satisfies Theme |
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,6 @@ | ||
#!/usr/bin/env bash | ||
|
||
cd "$(dirname "$(realpath "${BASH_SOURCE[0]}")")" | ||
yarn install | ||
[[ -e docs ]] || ln -sf ../../docs docs | ||
DEBUG='vitepress:*,vite:*' yarn run docs:build |
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 @@ | ||
{ | ||
"license": "GPL-2.0-or-later", | ||
"devDependencies": { | ||
"vite": "^5.2.10", | ||
"vitepress": "^1.1.0", | ||
"vitepress-plugin-tabs": "^0.5.0", | ||
"vue": "^3.4.24" | ||
}, | ||
"scripts": { | ||
"docs:dev": "vitepress dev --host 0.0.0.0", | ||
"docs:build": "vitepress build", | ||
"docs:preview": "vitepress preview --host 0.0.0.0" | ||
} | ||
} |
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,5 @@ | ||
#!/usr/bin/env bash | ||
|
||
cd "$(dirname "$(realpath "${BASH_SOURCE[0]}")")" | ||
yarn install | ||
DEBUG='vitepress:*,vite:*' yarn run docs:dev |
Oops, something went wrong.