Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vitepress conversion of docs. #23795

Merged
merged 30 commits into from
May 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
62b3290
Vitepress conversion of docs.
tzarc May 25, 2024
ee81400
Some broken link fixes.
tzarc May 25, 2024
3cbdb49
Link fixes and conversions.
tzarc May 25, 2024
4954a3a
Fixup code block language on `feature_stenography.md`.
tzarc May 25, 2024
81d308f
Workflow.
tzarc May 25, 2024
a0adc58
More link conversions.
tzarc May 25, 2024
2224e32
Apparently paths don't need resolving any more. Curious.
tzarc May 25, 2024
3909f5c
Resort to symlinks to get vitepress to cooperate. Static docs generat…
tzarc May 25, 2024
b002701
Apparently vitepress prefers not to use `.md` at the end.
tzarc May 25, 2024
6571207
More fighting GHA.
tzarc May 25, 2024
14c7682
Actually monitor the vitepress path.
tzarc May 25, 2024
7ad8701
Apply styling to <kbd> elements.
tzarc May 25, 2024
c16b752
Info panels.
tzarc May 25, 2024
a1d00c7
Manually convert single `<details>` expando.
tzarc May 25, 2024
583df7d
Severity increase.
tzarc May 25, 2024
54ad1cf
Sidebar.
tzarc May 27, 2024
f249d61
QMK Logo
tzarc May 27, 2024
99c80d4
Remove translations.
tzarc May 27, 2024
c7184f8
Merge `upstream/develop`.
tzarc May 28, 2024
b29721e
Cleanup.
tzarc May 28, 2024
aab7762
Merge remote-tracking branch 'upstream/master' into vitepress
tzarc May 28, 2024
dac111e
Tabs conversion.
tzarc May 28, 2024
fc72773
Logo.
tzarc May 28, 2024
1b48f9f
Docsify link redirection.
tzarc May 29, 2024
4060cd2
Still had a `/translating` link in sidebar.
tzarc May 29, 2024
101322a
Handle redirection of docsify links if they had the `?id=` suffix.
tzarc May 29, 2024
c5b4484
Stragglers the script didn't seem to pick up.
tzarc May 29, 2024
1146989
Merge remote-tracking branch 'upstream/master' into vitepress
tzarc May 29, 2024
fd4cbeb
Actual docs changes to describe how to launch docs.
tzarc May 30, 2024
576afda
Bump.
tzarc May 30, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
53 changes: 46 additions & 7 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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')
tzarc marked this conversation as resolved.
Show resolved Hide resolved

steps:
- uses: actions/checkout@v4
Expand All @@ -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'
tzarc marked this conversation as resolved.
Show resolved Hide resolved

- 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
tzarc marked this conversation as resolved.
Show resolved Hide resolved

- name: Deploy
if: github.repository == 'qmk/qmk_firmware'
uses: JamesIves/github-pages-deploy-action@v4.6.1
with:
token: ${{ secrets.GITHUB_TOKEN }}
branch: gh-pages
folder: .build/docs
git-config-name: QMK Bot
git-config-email: hello@qmk.fm

- name: Deploy
if: github.repository == 'tzarc/qmk_firmware'
uses: JamesIves/github-pages-deploy-action@v4.6.1
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BASE_BRANCH: master
BRANCH: gh-pages
FOLDER: .build/docs
GIT_CONFIG_EMAIL: hello@qmk.fm
branch: gh-pages
folder: .build/docs
tzarc marked this conversation as resolved.
Show resolved Hide resolved
70 changes: 35 additions & 35 deletions Doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ DOXYFILE_ENCODING = UTF-8
PROJECT_NAME = "QMK Firmware"
PROJECT_NUMBER = https://github.com/qmk/qmk_firmware
PROJECT_BRIEF = "Keyboard controller firmware for Atmel AVR and ARM USB families"
OUTPUT_DIRECTORY = .build/doxygen
OUTPUT_DIRECTORY = .build/docs/static/doxygen
ALLOW_UNICODE_NAMES = NO
OUTPUT_LANGUAGE = English
BRIEF_MEMBER_DESC = YES
Expand All @@ -40,22 +40,22 @@ ABBREVIATE_BRIEF = "The $name class" \
ALWAYS_DETAILED_SEC = NO
INLINE_INHERITED_MEMB = NO
FULL_PATH_NAMES = YES
STRIP_FROM_PATH =
STRIP_FROM_INC_PATH =
STRIP_FROM_PATH =
STRIP_FROM_INC_PATH =
SHORT_NAMES = NO
JAVADOC_AUTOBRIEF = NO
QT_AUTOBRIEF = NO
MULTILINE_CPP_IS_BRIEF = NO
INHERIT_DOCS = YES
SEPARATE_MEMBER_PAGES = NO
TAB_SIZE = 4
ALIASES =
TCL_SUBST =
ALIASES =
TCL_SUBST =
OPTIMIZE_OUTPUT_FOR_C = YES
OPTIMIZE_OUTPUT_JAVA = NO
OPTIMIZE_FOR_FORTRAN = NO
OPTIMIZE_OUTPUT_VHDL = NO
EXTENSION_MAPPING =
EXTENSION_MAPPING =
MARKDOWN_SUPPORT = YES
TOC_INCLUDE_HEADINGS = 2
AUTOLINK_SUPPORT = YES
Expand Down Expand Up @@ -104,14 +104,14 @@ GENERATE_TODOLIST = YES
GENERATE_TESTLIST = YES
GENERATE_BUGLIST = YES
GENERATE_DEPRECATEDLIST= YES
ENABLED_SECTIONS =
ENABLED_SECTIONS =
MAX_INITIALIZER_LINES = 30
SHOW_USED_FILES = YES
SHOW_FILES = YES
SHOW_NAMESPACES = YES
FILE_VERSION_FILTER =
LAYOUT_FILE =
CITE_BIB_FILES =
FILE_VERSION_FILTER =
LAYOUT_FILE =
CITE_BIB_FILES =

#---------------------------------------------------------------------------
# Configuration options related to warning and progress messages
Expand All @@ -124,7 +124,7 @@ WARN_IF_DOC_ERROR = YES
WARN_NO_PARAMDOC = NO
WARN_AS_ERROR = NO
WARN_FORMAT = "$file:$line: $text"
WARN_LOGFILE =
WARN_LOGFILE =

#---------------------------------------------------------------------------
# Configuration options related to the input files
Expand All @@ -143,19 +143,19 @@ FILE_PATTERNS = *.c \
*.hpp \
*.h++
RECURSIVE = YES
EXCLUDE =
EXCLUDE =
EXCLUDE_SYMLINKS = NO
EXCLUDE_PATTERNS = */protocol/arm_atsam/*
EXCLUDE_SYMBOLS =
EXAMPLE_PATH =
EXCLUDE_SYMBOLS =
EXAMPLE_PATH =
EXAMPLE_PATTERNS = *
EXAMPLE_RECURSIVE = NO
IMAGE_PATH =
INPUT_FILTER =
FILTER_PATTERNS =
IMAGE_PATH =
INPUT_FILTER =
FILTER_PATTERNS =
FILTER_SOURCE_FILES = NO
FILTER_SOURCE_PATTERNS =
USE_MDFILE_AS_MAINPAGE =
FILTER_SOURCE_PATTERNS =
USE_MDFILE_AS_MAINPAGE =

#---------------------------------------------------------------------------
# Configuration options related to source browsing
Expand All @@ -177,7 +177,7 @@ VERBATIM_HEADERS = YES

ALPHABETICAL_INDEX = YES
COLS_IN_ALPHA_INDEX = 5
IGNORE_PREFIX =
IGNORE_PREFIX =

#---------------------------------------------------------------------------
# Configuration options related to disabled outputs
Expand Down Expand Up @@ -207,18 +207,18 @@ ENABLE_PREPROCESSING = YES
MACRO_EXPANSION = NO
EXPAND_ONLY_PREDEF = NO
SEARCH_INCLUDES = YES
INCLUDE_PATH =
INCLUDE_FILE_PATTERNS =
INCLUDE_PATH =
INCLUDE_FILE_PATTERNS =
PREDEFINED = __DOXYGEN__ PROGMEM
EXPAND_AS_DEFINED =
EXPAND_AS_DEFINED =
SKIP_FUNCTION_MACROS = YES

#---------------------------------------------------------------------------
# Configuration options related to external references
#---------------------------------------------------------------------------

TAGFILES =
GENERATE_TAGFILE =
TAGFILES =
GENERATE_TAGFILE =
ALLEXTERNALS = NO
EXTERNAL_GROUPS = YES
EXTERNAL_PAGES = YES
Expand All @@ -229,14 +229,14 @@ PERL_PATH = /usr/bin/perl
#---------------------------------------------------------------------------

CLASS_DIAGRAMS = YES
MSCGEN_PATH =
DIA_PATH =
MSCGEN_PATH =
DIA_PATH =
HIDE_UNDOC_RELATIONS = YES
HAVE_DOT = NO
DOT_NUM_THREADS = 0
DOT_FONTNAME = Helvetica
DOT_FONTSIZE = 10
DOT_FONTPATH =
DOT_FONTPATH =
CLASS_GRAPH = YES
COLLABORATION_GRAPH = YES
GROUP_GRAPHS = YES
Expand All @@ -251,13 +251,13 @@ GRAPHICAL_HIERARCHY = YES
DIRECTORY_GRAPH = YES
DOT_IMAGE_FORMAT = png
INTERACTIVE_SVG = NO
DOT_PATH =
DOTFILE_DIRS =
MSCFILE_DIRS =
DIAFILE_DIRS =
PLANTUML_JAR_PATH =
PLANTUML_CFG_FILE =
PLANTUML_INCLUDE_PATH =
DOT_PATH =
DOTFILE_DIRS =
MSCFILE_DIRS =
DIAFILE_DIRS =
PLANTUML_JAR_PATH =
PLANTUML_CFG_FILE =
PLANTUML_INCLUDE_PATH =
DOT_GRAPH_MAX_NODES = 50
MAX_DOT_GRAPH_DEPTH = 0
DOT_TRANSPARENT = NO
Expand Down
5 changes: 5 additions & 0 deletions builddefs/docsgen/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
node_modules
.vitepress/cache
.vitepress/.temp
.vitepress/dist
docs
51 changes: 51 additions & 0 deletions builddefs/docsgen/.vitepress/config.mts
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" },
],
}
};
});
18 changes: 18 additions & 0 deletions builddefs/docsgen/.vitepress/theme/QMKLayout.vue
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>
19 changes: 19 additions & 0 deletions builddefs/docsgen/.vitepress/theme/custom.css
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;
}
13 changes: 13 additions & 0 deletions builddefs/docsgen/.vitepress/theme/index.ts
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
6 changes: 6 additions & 0 deletions builddefs/docsgen/build-docs.sh
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
14 changes: 14 additions & 0 deletions builddefs/docsgen/package.json
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"
}
}
5 changes: 5 additions & 0 deletions builddefs/docsgen/start-docs.sh
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
Loading
Loading