Documentation
BERA Tools uses Zensical for user, developer, and API documentation. The pages are written in Markdown. Zensical reads each site's mkdocs.yml through its supported compatibility layer; use the zensical CLI rather than invoking mkdocs directly.
One site per publication
The docs are split into sites, one per thing that is published: the frame site and one site per module. The public BERATool/beratools repository deploys them all to its GitHub Pages: the frame site at the root and each module's site under /<module>/. Anywhere else, such as a fork, the sites are only built.
| Site | Config | Public URL |
|---|---|---|
Frame: home, installation, GUI, bt, pipelines, developer and technical guides, frame API |
docs/mkdocs.yml |
https://beratool.github.io/beratools/ |
| Mapping | beratools/modules/mapping/docs/mkdocs.yml |
https://beratool.github.io/beratools/mapping/ |
| PC2Products | beratools/modules/pc2products/docs/mkdocs.yml |
https://beratool.github.io/beratools/pc2products/ |
| Raster2Products | beratools/modules/raster2products/docs/mkdocs.yml |
https://beratool.github.io/beratools/raster2products/ |
A repository has one Pages site, so each module's site is built separately and served under /<module>/ of the frame site, named after the module's folder (mapping, pc2products, …). A new module's site is published there with no other change.
Every site inherits the shared settings (theme, Markdown extensions, mkdocstrings) from docs/base.yml and adds its own site_name, site_url, nav and edit_uri. Module sites take the logo and CSS from the frame site.
Documentation File Structure
docs/
├── base.yml # settings shared by every site
├── mkdocs.yml # the frame site
└── files/
├── api.md # frame API reference
├── developer_guide.md # Developer guide
├── index.md # Documentation homepage
├── overview.md # Project overview
├── requirements.txt # Python requirements for Zensical
├── user_guide.md # User guide, with the list of modules
├── css/ # Custom CSS, also used by the module sites
├── developer/ # Developer-specific docs
├── icons/ # Project and documentation icons
├── screenshots/ # Screenshots for the frame pages
├── technical/ # Architecture and algorithm overview
└── user/ # Installation
beratools/modules/<module>/docs/
├── mkdocs.yml # the module's site
└── files/
├── index.md # the module's home page and tool table
├── api.md # the module's API reference
├── user/ # one page per tool
├── technical/ # the module's technical pages
└── screenshots/ # screenshots for the module's pages
The module docs are not shipped in the package: pyproject.toml excludes beratools/modules/*/docs from the wheel and sdist.
Links between pages and sites
- Within a site, link pages by their relative
.mdpath, e.g.[DTM](dtm.md). - To another site, use its full URL, e.g.
[Installation](https://beratool.github.io/beratools/user/installation/). A relative link to a page of another site fails the strict build. - Each tool's
tech_linkintools.json(the GUI's help button) is a path on its module's site, such asuser/dtm/, which the frame resolves against the module'sdocs_url.tests/test_registry.pychecks that each one names a page that exists.
Contribution Guidelines
To contribute to the documentation, please follow these guidelines:
- Clarity: Write clear and concise documentation.
- Structure: Organize content logically. Use headings, subheadings, and bullet points for easy navigation.
- Examples: Provide examples to illustrate complex concepts. Code snippets should be tested and functional.
- Updates: Keep documentation up-to-date with the latest changes in the codebase.
- Review Process: All documentation changes should be submitted as pull requests like code changes.
By following these guidelines, you can help ensure that BERA Tools documentation remains a valuable resource for all users.
Developing Documentation Locally
Activate the development environment described in the local development setup, then run these commands from the repository root.
- Install the required dependencies from the repository root:
python -m pip install -r docs/files/requirements.txt
Alternatively, install the documentation extra from pyproject.toml:
python -m pip install ".[doc]"
- Serve a site locally. This starts a development server that automatically rebuilds when files change:
zensical serve -f docs/mkdocs.yml
zensical serve -f beratools/modules/pc2products/docs/mkdocs.yml
Open http://127.0.0.1:8000 to preview the site.
- Build every site the way CI does. Each one is written to a
site/folder next to itsmkdocs.yml:
for site in docs/mkdocs.yml beratools/modules/*/docs/mkdocs.yml; do zensical build --strict -f "$site"; done
Deployment
.github/workflows/docs.yml builds every site in strict mode on pull requests that change the docs, the code (the API pages are built from it) or the build environment. In the public BERATool/beratools repository it also runs on pushes to main: it puts the sites together, the frame site at the root and each module's site under /<module>/, and deploys them to GitHub Pages. Anywhere else it only builds them. tests/test_docs_sites.py checks that each module's site_url and docs_url match that layout.
The public repository's Pages are set to deploy from GitHub Actions:
