Documentation Build Guide¶
This document explains how to build and work with the SCHISM-ESMF documentation.
Overview¶
The project documentation is built using MkDocs with the Material theme. The documentation sources are in Markdown format located in the doc/ directory.
Documentation Structure¶
schism-esmf/
├── doc/ # Documentation source files
│ ├── index.md # Homepage
│ ├── installation.md # Installation guide
│ ├── cmake-architecture.md # CMake build system details
│ ├── running-examples.md # How to run examples
│ ├── legal.md # License and legal information
│ ├── logo.png # Project logo
│ └── CMakeLists.txt # CMake build rules for docs
├── mkdocs.yml # MkDocs configuration
├── Readme.md # Main project README (linked in docs)
├── QUICKSTART.md # Quick start guide (linked in docs)
└── .github/
└── BUILD_TROUBLESHOOTING.md # Build troubleshooting (linked in docs)
Prerequisites¶
Required¶
- Python 3.8+
- MkDocs:
pip install mkdocs - MkDocs Material theme:
pip install mkdocs-material
Installation Options¶
Using pip (recommended)¶
Using conda/mamba¶
Using Poetry (for developers)¶
Building Documentation¶
Using CMake (Integrated Build)¶
The documentation build is integrated into the CMake build system.
Enable Documentation Build¶
Build HTML Documentation¶
The built documentation will be in build/docs/.
Serve Documentation Locally¶
This starts a local web server at http://127.0.0.1:8000 with live reloading.
Clean Documentation¶
Using MkDocs Directly¶
You can also build documentation directly with MkDocs without CMake:
Build¶
Output goes to site/ directory.
Serve Locally¶
Navigate to http://127.0.0.1:8000 to view.
Build for Deployment¶
The --strict flag treats warnings as errors.
CMake Integration Details¶
Build Option¶
The documentation build is controlled by the BUILD_DOCS CMake option:
It's OFF by default to avoid requiring Python/MkDocs for users who only want to build the software.
Docs-only Configure (no Fortran/MPI required)¶
If your Fortran/MPI toolchain isn't available, you can configure a documentation-only build:
mkdir -p build && cd build
cmake .. -DDOCS_ONLY=ON # Implicitly sets -DBUILD_DOCS=ON
cmake --build . --target docs
CMake Targets¶
| Target | Description |
|---|---|
docs |
Build HTML documentation |
docs-serve |
Start local documentation server |
docs-clean |
Remove built documentation |
Installation¶
When you run make install, the documentation is installed to:
- HTML documentation:
${CMAKE_INSTALL_PREFIX}/share/doc/SCHISM_ESMF_Interface/html/ - Markdown sources:
${CMAKE_INSTALL_PREFIX}/share/doc/SCHISM_ESMF_Interface/markdown/ - Top-level docs:
${CMAKE_INSTALL_PREFIX}/share/doc/SCHISM_ESMF_Interface/(Readme.md, QUICKSTART.md)
Example:
Continuous Integration¶
GitHub Actions Example¶
name: Build Documentation
on:
push:
branches: [main, develop]
pull_request:
jobs:
docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Install dependencies
run: |
pip install mkdocs mkdocs-material
- name: Build documentation
run: mkdocs build --strict
- name: Deploy to GitHub Pages
if: github.ref == 'refs/heads/main'
run: mkdocs gh-deploy --force
GitHub Pages Deployment¶
To deploy documentation to GitHub Pages:
This builds and pushes the documentation to the gh-pages branch.
Writing Documentation¶
File Format¶
All documentation files are Markdown (.md) with YAML front matter:
Code Blocks¶
Use fenced code blocks with language specification:
Admonitions¶
Use Material theme admonitions for callouts:
!!! note "Important Note"
This is an important note.
!!! warning
This is a warning.
!!! tip
This is a helpful tip.
Internal Links¶
Link to other documentation pages:
External Links¶
Link to GitHub files:
Troubleshooting¶
Python Not Found¶
Problem: Python3 not found during CMake configure.
Solution: Install Python 3.8+ and ensure it's in your PATH.
# macOS
brew install python@3.11
# Ubuntu/Debian
sudo apt install python3 python3-pip
# Windows
# Download from python.org
MkDocs Not Found¶
Problem: MkDocs not found warning during CMake configure.
Solution: Install MkDocs:
Material Theme Not Found¶
Problem: MkDocs Material theme not found warning.
Solution: Install the Material theme:
Build Fails with Import Errors¶
Problem: Documentation build fails with Python import errors.
Solution: Check that all required packages are installed:
python3 -c "import mkdocs; print(mkdocs.__version__)"
python3 -c "import material; print(material.__version__)"
If either fails, reinstall:
Documentation Doesn't Update¶
Problem: Changes to markdown files don't appear in built docs.
Solution:
1. Clean the build: make docs-clean or rm -rf site/
2. Rebuild: make docs or mkdocs build
When using mkdocs serve, changes should auto-reload. If not, restart the server.
Configuration Reference¶
mkdocs.yml Structure¶
site_name: Project Name # Site title
site_url: https://example.com # Base URL
docs_dir: ./doc # Source directory
site_dir: ./site # Output directory
theme:
name: material # Theme name
features: [...] # Theme features
nav: # Navigation structure
- Home: index.md
- Guide: guide.md
markdown_extensions: [...] # Markdown processing extensions
plugins: [...] # MkDocs plugins
Material Theme Features¶
Enabled features in mkdocs.yml:
toc.integrate- Integrate table of contents into navigationtoc.follow- Follow active item in ToCcontent.code.annotate- Code annotation supportnavigation.tabs- Top-level navigation tabsnavigation.sections- Group pages into sectionsnavigation.expand- Expand sections by defaultnavigation.top- "Back to top" buttonsearch.suggest- Search suggestionssearch.highlight- Highlight search terms
Markdown Extensions¶
Key extensions enabled:
admonition- Note/warning boxescodehilite- Syntax highlightingpymdownx.superfences- Nested code blockspymdownx.tabbed- Tabbed contentpymdownx.details- Collapsible sections
Best Practices¶
- Keep files focused: Each page should cover one topic
- Use clear headings: Hierarchical structure with H1, H2, H3
- Test locally: Always run
mkdocs serveto preview changes - Link generously: Cross-link related content
- Use code examples: Show, don't just tell
- Add screenshots: Visual aids help comprehension (when applicable)
- Update navigation: Add new pages to
mkdocs.ymlnav section - Follow naming conventions: Use lowercase-with-hyphens for filenames
Maintenance¶
Updating Dependencies¶
Check for MkDocs updates:
Update:
Checking for Broken Links¶
Install link checker:
Check built docs:
Documentation Review Checklist¶
Before committing documentation changes:
- [ ] Spell-check content
- [ ] Verify all links work
- [ ] Build with
--strictflag passes - [ ] Preview with
mkdocs servelooks correct - [ ] Code examples are tested and correct
- [ ] Navigation updated if new pages added
- [ ] Front matter (title, summary) is accurate
Resources¶
Getting Help¶
- MkDocs Issues: https://github.com/mkdocs/mkdocs/issues
- Material Theme Issues: https://github.com/squidfunk/mkdocs-material/issues
- Project Docs Issues: https://github.com/schism-dev/schism-esmf/issues
Last Updated: November 2025
Maintainer: Carsten Lemmen carsten.lemmen@hereon.de