Skip to content

Documentation & Building

This documentation is built with MkDocs + the Material theme + the i18n plugin. The source is the docs/ folder.

Local preview

pip install "mkdocs>=1.6" "mkdocs-material>=9.7,<9.8" "mkdocs-static-i18n>=1.0"
mkdocs serve        # default http://127.0.0.1:8000, with live reload

Version requirements

  • mkdocs-static-i18n must be ≥ 1.0. The 0.x line reads the material version and language list through pkg_resources, which setuptools ≥ 81 removed, and material 9.6 moved its templates to material/templates/partials/. With 0.x the plugin concludes that material is missing, so no language switcher is generated and <html lang> never changes — the site silently degrades to Chinese-only.
  • material 9.7.2+ changed internal interfaces the plugin relies on; 9.7.1 is the safest choice. After upgrading material, run mkdocs build --strict again and confirm the switcher still renders.

Build the static site

mkdocs build --strict   # output to site/; --strict fails on broken links, missing translations or pages absent from nav
mkdocs gh-deploy        # publish to GitHub Pages

Output layout (the default language zh sits at the site root):

site/
├── index.html          # Chinese (default language)
├── en/                 # English
├── search/             # shared bilingual search index (per-language stemming)
└── sitemap.xml

Directory convention

docs/
├── zh/             # Chinese (default language)
└── en/             # English
    Each language folder shares the same structure: index.md, about.md, guide/, dev/, api/
  • Adding a page: create a same-named file in both zh/ and en/, then register it in the nav of mkdocs.yml.
  • Chinese → English navigation mappings live under nav_translations of the locale: en entry in languages (since 1.x this is per language, not a top-level option).
  • The English site title can be overridden with site_name on the locale: en entry.

Code conventions (for contributors)

  • File names: UI feature pages use Chinese pinyin (e.g. shouye.py = Home, shezhi.py = Settings); library modules such as core/, functions/ use English.
  • Layering: computation logic goes in functions/ (pure functions, no Qt); UI goes in ui/; shared services go in core/.
  • Docstrings: public functions / classes should have docstrings to support the API reference.
  • Lazy loading: new UI modules must be registered in _submodules of ui/__init__.py to benefit from faster startup.

Documentation categories

This help site is split into three categories for different readers:

  • User Guide (guide/): for end users — installation, configuration, and how to use each feature.
  • Developer Guide (dev/): for contributors — architecture, how to add a feature, internationalization, and building docs.
  • API Reference (api/): for integrators — the public functions of each core/ and functions/ module.

Contribution workflow

  1. Fork the repository and create a branch.
  2. Update docs in both docs/zh and docs/en.
  3. Run mkdocs build --strict locally to confirm no broken links / missing translations.
  4. Open a Pull Request.