This repository contains the Sphinx documentation project for MuduDB.
The documentation is written in Markdown through MyST Parser, organized by database version and language, and built into static HTML for publication.
mududb.document/
source/
conf.py
_static/
custom.css
versions/
v0.1/
en/
index.md
...
zh_cn/
index.md
...
scripts/
build_docs.py
.github/
workflows/
docs.yml
Version and language are both part of the source path:
source/versions/<db-version>/<language>/
Current starter content:
v0.1/env0.1/zh_cn
Add future database versions by copying an existing version directory, for example:
Copy-Item -Recurse source\versions\v0.1 source\versions\v0.2Then update source/versions/versions.json.
Use Python 3.10 or newer.
Create and activate a virtual environment before installing dependencies.
Linux / macOS:
python3 -m venv .venv
source .venv/bin/activateWindows (PowerShell):
python -m venv .venv
.venv\Scripts\Activate.ps1Windows (CMD):
python -m venv .venv
.venv\Scripts\activate.batWith the virtual environment activated:
python -m pip install -r requirements.txtBuild all configured versions and languages:
python scripts/build_docs.pyBuild one version and language:
python scripts/build_docs.py --version v0.1 --language en
python scripts/build_docs.py --version v0.1 --language zh_cnGenerated HTML is written to:
build/html/<version>/<language>/
The script also creates:
build/html/index.html, redirecting to the default version and language.build/html/.nojekyll, for GitHub Pages compatibility.
After building:
python -m http.server 8000 --directory build/htmlOpen:
http://127.0.0.1:8000/
Write pages in Markdown (.md). MyST extensions are enabled for common documentation features:
- fenced code blocks
- tables
- definition lists
- task lists
- admonitions
- colon fences
- field lists
- smart quotes and replacements
Use Sphinx toctrees in Markdown:
```{toctree}
:maxdepth: 2
getting-started/index
reference/index
```Each page should belong to one version and one language. Do not share mutable text files across languages; keep translation ownership explicit.
Use this policy for database releases:
- Patch-level documentation fixes can be made in the affected version directory.
- New feature documentation should be added to the next active version directory.
- When a DB release becomes historical, keep its directory intact and avoid restructuring it.
- If a page is removed in a future version, leave the older version unchanged.
Update source/versions/versions.json when adding or retiring maintained versions:
{
"default_version": "v0.1",
"default_language": "zh_cn",
"versions": ["v0.1"],
"languages": {
"en": "English",
"zh_cn": "简体中文"
}
}The workflow at .github/workflows/docs.yml builds the final static HTML and publishes only generated artifacts.
The workflow publishes generated HTML to the docs directory in https://github.com/mududb/mududb.github.io.
Configure these repository variables/secrets in the documentation repository:
- Secret
PAGES_DEPLOY_TOKEN: GitHub token with access tomududb/mududb.github.io. Fine-grained tokens must include the target repository andContents: Read and write. Classic tokens needrepoaccess.
The workflow publishes build/html into docs/ in mududb/mududb.github.io. Source files from this repository are not published.
Publishing is manual: run the workflow with command=publish. Pushes to main run the build job only.
- Update or copy the version directory under
source/versions. - Update
source/versions/versions.json. - Build locally with
python scripts/build_docs.py. - Inspect
build/html/index.htmland one language page. - Push to
mainto run the build check. - Run the workflow manually with
command=publishto publish generated HTML.