Documentation Guide¶
How to maintain and contribute to TradAI documentation.
Quick Reference¶
| Task | Command |
|---|---|
| Preview locally | just docs |
| Build static site | just docs-build |
| Deploy manually | just docs-deploy |
Architecture¶
The documentation uses MkDocs Material and follows a symlink-based approach to avoid content duplication.
docs/ # MkDocs source
├── index.md # Homepage (standalone)
├── quickstarts/ # Standalone quickstart guides
├── developer-guides/ # Standalone dev guides
├── runbooks/ # Standalone runbooks
├── troubleshooting/ # Standalone troubleshooting
├── architecture/ # Symlinks → reports/final-architecture/
├── libs/ # Symlinks → libs/*/README.md
├── services/ # Symlinks → services/*/README.md
└── design/ # Symlinks → libs/*/DESIGN.md
mkdocs.yml # Site configuration
scripts/prepare-docs.sh # Creates symlinks before build
Symlinked Content¶
These sections pull content from source files (single source of truth):
| Docs Section | Source Location |
|---|---|
| Architecture | reports/final-architecture/*.md |
| Libraries | libs/*/README.md |
| Services | services/*/README.md |
| Technical Design | libs/*/DESIGN.md |
To update these: Edit the source file, not the docs folder.
Standalone Content¶
These live directly in docs/ and are edited there:
- Quickstarts (
docs/quickstarts/) - Developer Guides (
docs/developer-guides/) - Runbooks (
docs/runbooks/) - Troubleshooting (
docs/troubleshooting/) - Glossary (
docs/glossary.md) - API Reference (
docs/reference/api.md)
Adding New Content¶
Add a New Page¶
-
Create the markdown file in the appropriate directory:
-
Add to
mkdocs.ymlnavigation: -
Preview locally:
Add a New Library/Service¶
-
Create the README.md in the source location:
-
Update
scripts/prepare-docs.shto include it: -
Add to
mkdocs.ymlnavigation:
Add a New Section¶
-
Create directory and index:
-
Add to
mkdocs.yml:
Writing Guidelines¶
Use Admonitions¶
Highlight important information with callouts:
!!! tip "Quick Tip"
Use `just check` to run all validations.
!!! warning "Caution"
This affects production data.
!!! danger "Breaking Change"
Not backwards compatible.
!!! note "Note"
Additional context here.
!!! info "Info"
Background information.
Code Blocks¶
Always specify the language:
### Tables
Use markdown tables for structured data:
```markdown
| Option | Description | Default |
|--------|-------------|---------|
| `--dry-run` | Simulate only | `false` |
Internal Links¶
Use relative paths:
Local Development¶
Preview Changes¶
Build Static Site¶
Test Before Commit¶
- Run
just docsand check: - [ ] New pages render correctly
- [ ] Navigation shows new items
- [ ] Links work (no 404s)
- [ ] Code blocks have syntax highlighting
- [ ] Admonitions display properly
CI/CD Pipeline¶
Automatic Deployment¶
Documentation deploys automatically when these files change on main:
docs/**mkdocs.ymllibs/**/README.mdlibs/**/DESIGN.mdservices/**/README.mdreports/final-architecture/**scripts/prepare-docs.sh
Manual Deployment¶
Workflow File¶
See .github/workflows/docs.yml for the full pipeline:
- Checkout code
- Install Python 3.11
- Install system deps (cairo for social cards)
- Install MkDocs and plugins
- Run
prepare-docs.sh(create symlinks) - Convert symlinks to files (for gh-pages)
- Deploy with
mkdocs gh-deploy
Configuration Reference¶
mkdocs.yml Structure¶
site_name: TradAI Documentation
site_url: https://tradai-bot.github.io/tradai-uv/
repo_url: https://github.com/tradai-bot/tradai-uv
edit_uri: edit/main/docs/ # Enables "Edit on GitHub"
theme:
name: material
favicon: assets/favicon.svg
icon:
logo: material/chart-line
repo: fontawesome/brands/github
palette: # Dark/light mode
- scheme: slate
toggle:
icon: material/brightness-4
- scheme: default
toggle:
icon: material/brightness-7
features:
- navigation.tabs # Top tabs
- navigation.sections # Sidebar sections
- search.suggest # Search suggestions
- content.code.copy # Copy button on code
- content.action.edit # Edit on GitHub button
plugins:
- search
- social: # Social cards (CI only)
enabled: !ENV [CI, false]
- minify:
minify_html: true
nav: # Site navigation
- Home: index.md
- Section:
- section/index.md
- Page: section/page.md
Adding Features¶
| Feature | How to Enable |
|---|---|
| Search | Already enabled via search plugin |
| Dark mode | Already enabled via palette toggle |
| Code copy | content.code.copy in features |
| Edit button | edit_uri + content.action.edit |
| Social cards | social plugin (CI-only due to cairo) |
Troubleshooting¶
Symlink Errors¶
If symlinks break:
Missing Page in Nav¶
Check that: 1. File exists in docs/ or is symlinked 2. Entry exists in mkdocs.yml nav: section 3. Path matches exactly (case-sensitive)
Social Cards Not Generating Locally¶
Social cards require cairo library. On macOS:
If still failing, social cards are CI-only (enabled: !ENV [CI, false]).
404 on GitHub Pages¶
- Check
site_urlinmkdocs.ymlmatches your repo - Ensure GitHub Pages is enabled (Settings → Pages → gh-pages branch)
- Wait 1-2 minutes after deployment