Documentation Development¶
This guide covers how to contribute to and maintain the jinpy-utils documentation.
Overview¶
jinpy-utils uses MkDocs with Material for MkDocs theme to generate comprehensive documentation that includes:
- Manual documentation - Written in Markdown
- API documentation - Automatically generated from source code
- Interactive examples - Code snippets with syntax highlighting
- Multi-version support - Version-aware documentation
- Search functionality - Full-text search across all content
Documentation Structure¶
Our documentation follows the Diátaxis framework:
docs/
├── index.md # Home page
├── getting-started/ # Tutorials (learning-oriented)
│ ├── installation.md
│ ├── quick-start.md
│ └── configuration.md
├── guides/ # How-to guides (problem-oriented)
│ ├── logger/
│ ├── base-exceptions/
│ └── utils/
├── reference/ # API reference (information-oriented)
│ ├── index.md
│ ├── logger/
│ ├── base/
│ └── utils/
├── development/ # Development guides
│ ├── contributing.md
│ ├── setup.md
│ └── documentation.md # This file
└── assets/ # Static assets
├── stylesheets/
├── javascripts/
└── images/
Content Types¶
Tutorials (Getting Started)¶
- Purpose: Learning-oriented, step-by-step guidance
- Audience: New users who want to learn
- Structure: Sequential, building complexity gradually
- Style: Friendly, encouraging, practical
Guides (User Guide)¶
- Purpose: Problem-oriented, specific solutions
- Audience: Users who know what they want to achieve
- Structure: Goal-focused, task-oriented
- Style: Direct, actionable, comprehensive
Reference (API Reference)¶
- Purpose: Information-oriented, comprehensive details
- Audience: Users who need precise information
- Structure: Systematic, complete, consistent
- Style: Factual, accurate, cross-linked
Explanations (Development)¶
- Purpose: Understanding-oriented, background and context
- Audience: Users who want to understand why and how
- Structure: Topic-based, interconnected concepts
- Style: Thoughtful, balanced, clarifying
Local Development¶
Prerequisites¶
Ensure you have the required dependencies:
# Install project with documentation dependencies
pip install -e .[dev]
# Or install documentation dependencies only
pip install mkdocs mkdocs-material mkdocstrings[python]
Quick Start¶
Start the development server:
# Using make (recommended)
make docs-serve
# Or using the build script
python scripts/build-docs.py serve
# Or directly with mkdocs
mkdocs serve
The documentation will be available at http://localhost:8000 with live reload.
Available Commands¶
We provide several convenient commands for documentation development:
# Development
make docs-serve # Start development server
make docs-build # Build production documentation
make docs-validate # Validate links and structure
# Maintenance
make docs-clean # Clean build artifacts
make docs-optimize # Optimize images and assets
make docs-stats # Show documentation statistics
# Advanced
make docs-pdf # Generate PDF documentation
make docs-versions # Build multi-version documentation
make docs-all # Complete build pipeline
See make docs-help for a complete list of available commands.
Writing Documentation¶
Markdown Guidelines¶
We use extended Markdown with additional features:
Basic Formatting¶
# Main heading (H1) - only one per page
## Section heading (H2)
### Subsection heading (H3)
**Bold text** for emphasis
*Italic text* for subtle emphasis
`code` for inline code references
Code Blocks¶
Use fenced code blocks with language specification:
```python title="example.py"
from jinpy_utils.logger import get_logger
logger = get_logger("example")
logger.info("Hello, world!")
#### Admonitions
Use admonitions for important information:
```markdown
!!! info "Information"
This is general information that users should know.
!!! warning "Warning"
This is something users should be careful about.
!!! danger "Danger"
This is something that could cause serious problems.
!!! tip "Pro Tip"
This is a helpful tip for advanced users.
!!! example "Example"
This shows a practical example.
Tabs¶
Group related information with tabs:
=== "Python"
```python
from jinpy_utils.logger import get_logger
logger = get_logger("app")
```
=== "Configuration"
```yaml
logger:
level: INFO
backends:
- type: console
```
Links and Cross-References¶
# Internal links
[Installation Guide](installation.md)
[API Reference](../reference/logger/core.md)
# External links
[MkDocs Documentation](https://www.mkdocs.org/)
# Cross-references with anchors
[Logger Configuration](#logger-configuration)
API Documentation¶
API documentation is automatically generated from source code using mkdocstrings:
# Include complete module documentation
::: jinpy_utils.logger.get_logger
options:
show_source: true
show_signature_annotations: true
# Include specific class members
::: jinpy_utils.logger.Logger
options:
members:
- __init__
- info
- error
- debug
Documentation Standards¶
Writing Style¶
- Clear and concise: Use simple, direct language
- Active voice: "Configure the logger" vs "The logger should be configured"
- Present tense: "The function returns" vs "The function will return"
- User-focused: Address the reader as "you"
- Consistent terminology: Use the same terms throughout
Code Examples¶
- Complete and runnable: Examples should work when copy-pasted
- Realistic: Use practical, real-world scenarios
- Well-commented: Explain non-obvious parts
- Error handling: Show proper error handling patterns
- Import statements: Always include necessary imports
# Good example - complete and realistic
from jinpy_utils.logger import get_logger, create_production_config
from jinpy_utils.base import JPYConfigurationError
try:
# Configure for production use
config = create_production_config()
logger = get_logger("payment_service", config)
# Process payment with structured logging
logger.info("Processing payment",
user_id=123,
amount=99.99,
currency="USD")
except JPYConfigurationError as e:
print(f"Configuration error: {e.message}")
# Handle configuration error appropriately
Screenshots and Images¶
- High quality: Use high-resolution images
- Consistent style: Maintain visual consistency
- Alt text: Always include descriptive alt text
- Optimization: Optimize images for web (use
make docs-optimize)
Advanced Features¶
Multi-Version Documentation¶
We support multiple versions of documentation using mike:
# Deploy specific version
mike deploy v1.0.0 latest --update-aliases
# Set default version
mike set-default latest
# List all versions
mike list
Custom Styling¶
Custom CSS is located in docs/assets/stylesheets/custom.css:
/* Brand colors */
:root {
--md-primary-fg-color: #1976d2;
--md-accent-fg-color: #2196f3;
}
/* Custom components */
.api-reference {
border-left: 4px solid var(--md-primary-fg-color);
padding-left: 1rem;
}
Custom JavaScript¶
Interactive features are in docs/assets/javascripts/custom.js:
// Add copy feedback to code blocks
function addCopyFeedback() {
const copyButtons = document.querySelectorAll('[data-clipboard-target]');
// Implementation details...
}
Search Configuration¶
Search is configured in mkdocs.yml:
Content Guidelines¶
Writing Tutorials¶
Tutorials should be learning-oriented and take users through a complete journey:
- Clear objective: State what the user will learn
- Prerequisites: List what users need to know/have
- Step-by-step: Break down into manageable steps
- Verification: Help users confirm they're on track
- Next steps: Point to related content
Writing Guides¶
How-to guides should be problem-oriented and solution-focused:
- Problem statement: Clearly define the problem
- Solution overview: Brief overview of the approach
- Detailed steps: Specific implementation details
- Variations: Alternative approaches or configurations
- Troubleshooting: Common issues and solutions
Writing Reference¶
API reference should be comprehensive and systematic:
- Consistent structure: Same format for all items
- Complete information: All parameters, return values, exceptions
- Type information: Precise type annotations
- Examples: Practical usage examples
- Cross-references: Links to related functionality
Quality Assurance¶
Automated Checks¶
Our CI/CD pipeline automatically:
- Validates markdown syntax: Checks for syntax errors
- Verifies links: Validates internal and external links
- Builds documentation: Ensures successful builds
- Optimizes assets: Compresses images and minifies CSS/JS
- Checks HTML output: Validates generated HTML
Manual Review Process¶
- Content review: Verify accuracy and completeness
- Style review: Check adherence to style guidelines
- Link testing: Manually test critical links
- Cross-browser testing: Test on different browsers
- Mobile testing: Ensure mobile responsiveness
Performance Considerations¶
- Image optimization: Use
make docs-optimize - Minimize dependencies: Only include necessary plugins
- Efficient search: Configure search for optimal performance
- CDN usage: Use CDNs for external resources
Troubleshooting¶
Common Issues¶
Build Failures¶
Link Validation Failures¶
# Check specific links
markdown-link-check docs/path/to/file.md
# Skip external links
markdown-link-check --config .github/markdown-link-check.json
Plugin Issues¶
# Clear plugin cache
rm -rf .mkdocs_cache/
# Reinstall plugins
pip install --upgrade --force-reinstall mkdocs-material mkdocstrings
Development Tips¶
- Use live reload: The development server automatically reloads on changes
- Check browser console: Look for JavaScript errors
- Validate early: Run
make docs-validatefrequently - Test on mobile: Use browser developer tools
- Monitor performance: Check page load times
Contributing to Documentation¶
Getting Started¶
- Fork the repository: Create your own fork on GitHub
- Clone locally: Clone your fork to your development machine
- Install dependencies: Run
pip install -e .[dev] - Start development server: Run
make docs-serve - Make changes: Edit documentation files
- Test thoroughly: Validate your changes work correctly
- Submit PR: Create a pull request with your changes
PR Guidelines¶
- Clear title: Describe what your PR changes
- Detailed description: Explain why the change is needed
- Test your changes: Ensure all checks pass
- Follow style guide: Adhere to our writing standards
- Update related docs: Keep cross-references current
Review Process¶
- Automated checks: CI pipeline validates changes
- Peer review: Team members review content and code
- Final approval: Maintainer approves and merges
- Deployment: Changes automatically deploy to live site
Resources¶
Documentation Tools¶
Writing Resources¶
Markdown Resources¶
Questions?¶
If you have questions about documentation:
- Check this guide: Most common questions are covered here
- Search existing docs: Use the search functionality
- Check GitHub issues: Look for related discussions
- Ask in discussions: Use GitHub Discussions for questions
- Contact maintainers: Reach out to the core team