ADR-027: Documentation Generation Strategy with MkDocs
Status
Accepted - 2025-10-01
Context
The Fork Management Template requires comprehensive documentation for:
- Template Documentation: How to use and maintain the template itself
- Architectural Decisions: ADRs and their evolution over time
- Workflow Documentation: Detailed guides for each workflow
- API Documentation: Reusable actions and their interfaces
- User Guides: Step-by-step instructions for common tasks
The documentation needed to be: - Automatically published and versioned - Searchable and well-organized - Maintainable alongside code - Accessible via GitHub Pages - Professional in appearance
Decision
Implement MkDocs Material as the documentation generation system with:
- MkDocs Material Theme: Professional, responsive documentation site
- GitHub Pages Deployment: Automatic publishing via GitHub Actions
- Markdown-Based Content: Documentation as code in the repository
- ADR Integration: Automatic inclusion of all ADRs in documentation
- Search Functionality: Built-in search across all documentation
Rationale
Why MkDocs Material
- Developer-Friendly: Markdown-based, lives with code
- Professional Appearance: Material Design theme is clean and modern
- Feature-Rich: Search, navigation, syntax highlighting built-in
- GitHub Integration: Works seamlessly with GitHub Pages
- Active Community: Well-maintained with regular updates
Documentation as Code Benefits
- Version Control: Documentation versioned with code
- Pull Request Reviews: Documentation changes reviewed like code
- Consistency: Single source of truth in repository
- Automation: Generated and published automatically
- Searchability: Full-text search across all documentation
Alternatives Considered
1. GitHub Wiki
- Pros: Built into GitHub, no setup required
- Cons: Separate from code, poor version control, limited features
- Decision: Rejected - Lacks version control and automation
2. Docusaurus
- Pros: React-based, highly customizable, versioning support
- Cons: More complex, requires Node.js build pipeline
- Decision: Rejected - Unnecessary complexity for current needs
3. Sphinx
- Pros: Powerful, extensive plugin ecosystem, reStructuredText
- Cons: Python-specific, steeper learning curve, complex configuration
- Decision: Rejected - MkDocs simpler for Markdown content
4. Jekyll (GitHub Pages default)
- Pros: GitHub native support, Ruby-based, simple
- Cons: Less features, dated appearance, limited search
- Decision: Rejected - MkDocs Material provides better UX
5. No Documentation Site
- Pros: Simplest approach, just README files
- Cons: Poor discoverability, no search, unprofessional
- Decision: Rejected - Documentation critical for adoption
Implementation Details
Directory Structure
doc/
├── mkdocs.yml # MkDocs configuration
├── src/
│ ├── index.md # Home page
│ ├── architecture/ # Architecture documentation
│ ├── workflows/ # Workflow guides
│ ├── decisions/ # ADRs
│ ├── images/ # Diagrams and screenshots
│ ├── stylesheets/ # Custom CSS
│ └── javascripts/ # Custom JavaScript
└── README.md # Documentation about documentation
MkDocs Configuration
# mkdocs.yml
site_name: OSDU Fork Management
site_url: https://azure.github.io/osdu-spi
theme:
name: material
features:
- navigation.instant
- navigation.tracking
- navigation.sections
- search.highlight
- content.code.copy
palette:
primary: indigo
accent: indigo
plugins:
- search
- mermaid2
nav:
- Home: index.md
- Architecture:
- Overview: architecture/overview.md
- Three-Branch Strategy: architecture/three_branch_strategy.md
- Workflows:
- Initialization: workflows/initialization.md
- Synchronization: workflows/synchronization.md
- Build: workflows/build.md
- Decisions:
- Index: decisions/index.md
- ADRs: decisions/*.md
GitHub Actions Workflow
# .github/workflows/docs.yml
name: Documentation
on:
push:
branches: [main]
paths:
- 'doc/**'
- 'mkdocs.yml'
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: actions/setup-python@v4
- run: pip install mkdocs-material
- run: mkdocs gh-deploy --force
Documentation Categories
| Category | Content | Update Frequency |
|---|---|---|
| Architecture | System design, patterns | On architectural changes |
| Workflows | Detailed workflow guides | On workflow updates |
| Decisions | ADRs | On new decisions |
| API Reference | Action interfaces | On action changes |
| User Guides | How-to documentation | As needed |
Consequences
Positive
- Professional Documentation: Clean, searchable documentation site
- Automatic Publishing: Changes published on merge to main
- Version Control: Documentation versioned with code
- Search Capability: Full-text search across all content
- Mobile Friendly: Responsive design works on all devices
- Low Maintenance: Minimal ongoing maintenance required
Negative
- Build Dependency: Requires Python and MkDocs for local preview
- Learning Curve: Team needs to learn MkDocs configuration
- Build Time: Adds ~2 minutes to CI/CD pipeline
- Storage: GitHub Pages has 1GB limit (not a practical concern)
Neutral
- Markdown Only: Limited to Markdown formatting capabilities
- Theme Lock-in: Customization limited to Material theme options
- GitHub Pages: Tied to GitHub's hosting service
Success Criteria
- Documentation site builds and deploys successfully on every merge
- Search returns relevant results across all documentation
- Page load time < 2 seconds for documentation pages
- Documentation stays in sync with code changes
- ADRs automatically included in documentation site
- Mobile and desktop responsive design works correctly
Integration Points
With GitHub Actions (ADR-002)
- Automated build and deployment via GitHub Actions
- Triggered on documentation changes to main branch
- Uses GitHub Pages for hosting
With ADR System
- All ADRs automatically included in documentation
- ADR index page generated from file system
- Cross-references between ADRs maintained
With Template Distribution
- Documentation included in template repository
- Fork repositories can customize their documentation
- Template updates include documentation improvements
Future Evolution
Potential Enhancements
- API Documentation Generation: Auto-generate from code comments
- Multi-Version Documentation: Support multiple versions
- Internationalization: Multi-language documentation support
- Interactive Examples: Embedded code playgrounds
- Video Tutorials: Embedded video content
- PDF Export: Generate PDF versions of documentation
Integration Opportunities
- Link documentation to GitHub Discussions
- Integrate with search engines for better SEO
- Add analytics to understand usage patterns
- Create documentation feedback system
Migration Path
For repositories adopting this documentation strategy:
- Copy MkDocs configuration from template
- Move existing documentation to
doc/src/structure - Configure GitHub Pages in repository settings
- Run initial deployment to validate setup
- Update repository README with documentation link
Related ADRs
- ADR-002: GitHub Actions-Based Automation Architecture - Automation for docs deployment
- ADR-003: Template Repository Pattern - Documentation distribution
- ADR-011: Configuration-Driven Template Synchronization - Docs sync strategy