Contributing to R-Type Documentation
This guide explains how to add and organize documentation for the R-Type project. Documentation is automatically deployed to ReadTheDocs on every push to the main branch.
Table of Contents
Project Structure
R-Type/
├── mkdocs.yml # Main configuration
└── docs/ # 📁 All documentation files go here
├── index.md # Homepage
├── contributing.md
├── requirements.txt # Python dependencies
├── extra.css # Custom CSS styles
├── getting-started/
│ ├── index.md
│ └── install.md
├── guide/
│ ├── basics/
│ └── advanced/
└── api/
└── reference.md
⚠️ Important: All your Markdown files must be in the docs/ folder.
Adding a New Page
Step 1: Create the Markdown File
Create a new .md file in the appropriate folder:
Step 2: Write the Content
Edit the file with your content:
# Network Protocol
This document describes the UDP communication protocol used by R-Type.
## Overview
The protocol is binary and UDP-based...
## Packet Structure
### Connection Packet
| Field | Type | Size | Description |
|-------|-------|--------|-------------|
| ID | uint8 | 1 byte | Identifier |
| ... | ... | ... | ... |
Step 3: Add the Page to Navigation
Open mkdocs.yml and add your page to the nav section:
nav:
- Home: index.md
- Architecture:
- architecture/index.md
- Protocol: architecture/protocol.md # ← Your new page
- Server: architecture/server.md
Step 4: Commit and Push
Once your changes are made, commit and push:
git add docs/architecture/protocol.md mkdocs.yml
git commit -m "docs: add network protocol documentation"
git push
ReadTheDocs will automatically rebuild the documentation and it will be available in a few minutes at https://r-type-rennes.readthedocs.io/en/latest or https://r-type-rennes.readthedocs.io/en/dev
Routing System (Navigation)
Routing defines how pages appear in the sidebar menu. Everything is configured in mkdocs.yml under the nav section.
Basic Syntax
Structure Types
1. Simple Page
Result: Two links at the same level in the sidebar.
2. Section with Sub-pages
nav:
- Getting Started:
- Installation: getting-started/install.md
- Configuration: getting-started/config.md
Result: "Getting Started" section in bold (expandable) containing 2 sub-pages.
💡 Why bold? The
navigation.sectionsfeature automatically bolds sections containing sub-pages to improve readability.
3. Section with Index Page
nav:
- API Reference:
- api/index.md # Page displayed when clicking "API Reference"
- Classes: api/classes.md
- Functions: api/functions.md
Result: Clicking "API Reference" displays api/index.md, while still providing access to sub-pages.
⚠️ Important: Requires the
navigation.indexesfeature (already enabled in our config).
4. Nested Sections (Multi-level)
nav:
- Documentation:
- Getting Started:
- docs/getting-started/index.md
- Installation: docs/getting-started/install.md
- Advanced Topics:
- Architecture: docs/advanced/architecture.md
- Performance: docs/advanced/performance.md
Result: Multi-level hierarchy with sections and sub-sections.
5. External Link
nav:
- GitHub: https://github.com/eliestroun14/R-Type
- Report Bug: https://github.com/eliestroun14/R-Type/issues
Result: Clickable links that open in a new tab.
Complete Navigation Example
nav:
# Homepage
- Home: index.md
# Simple section
- Contributing: contributing.md
# Section with index and sub-pages
- Getting Started:
- getting-started/index.md
- Installation: getting-started/install.md
- Configuration: getting-started/config.md
# Section with sub-sections
- Architecture:
- architecture/index.md
- Client:
- Overview: architecture/client/overview.md
- Rendering: architecture/client/rendering.md
- Server:
- Overview: architecture/server/overview.md
- Networking: architecture/server/networking.md
- Protocol: architecture/protocol.md
# Simple section with multiple pages
- API Reference:
- api/index.md
- Classes: api/classes.md
- Functions: api/functions.md
# External links
- GitHub: https://github.com/eliestroun14/R-Type
Routing Best Practices
✅ DO
- Organize logically: Group pages by theme
- Folder structure = navigation structure:
docs/
├── getting-started/
│ ├── index.md
│ └── install.md
└── architecture/
├── index.md
└── protocol.md
- Use index.md for important sections:
- Clear and descriptive names:
❌ DON'T
- Paths too deep: Maximum 3-4 levels
- Redundant names:
- Orphan pages: Every important page should be in the
nav
Support
If you have questions about documentation:
- Open an issue on GitHub with the
documentationlabel - Ask in the channel
#documentationon Discord - Check examples in existing pages
Happy documenting! 📚