Contributing
Thank you for your interest in contributing to the MkDocs Graph Plugin!
Ways to Contribute
- ๐ Report bugs
- ๐ก Request features
- ๐ Improve documentation
- ๐ง Submit code changes
- ๐งช Add tests
- ๐ Improve translations
Getting Started
Development Setup
- Fork and clone the repository:
- Create a virtual environment:
- Install in development mode:
- Test the plugin:
Making Changes
- Create a feature branch:
- Make your changes:
Edit the relevant files:
- mkdocs_graph_plugin/plugin.py - Backend logic
- mkdocs_graph_plugin/config.py - Configuration options
- mkdocs_graph_plugin/assets/javascripts/graph.js - Frontend visualization
- mkdocs_graph_plugin/assets/stylesheets/graph.css - Styling
- Test your changes:
- Commit your changes:
- Push and create PR:
Then create a Pull Request on GitHub.
Code Guidelines
Python Code Style
- Follow PEP 8
- Use meaningful variable names
- Add docstrings to functions
- Keep functions focused and small
Example:
def extract_links(html: str) -> list[str]:
"""
Extract internal links from HTML content.
Args:
html: HTML content to parse
Returns:
List of internal link URLs
"""
parser = LinkParser()
parser.feed(html)
return parser.links
JavaScript Code Style
- Use ES6+ features
- Add comments for complex logic
- Keep functions small and focused
- Use meaningful variable names
Example:
/**
* Initialize graph visualization
* @param {HTMLElement} container - Container element
* @param {Object} data - Graph data with nodes and links
* @param {Object} options - Configuration options
*/
function initGraph(container, data, options) {
// Implementation
}
CSS Code Style
- Use Material theme CSS variables
- Add comments for sections
- Keep selectors specific but not overly complex
Example:
/* --- Mini Graph Container --- */
#mini-graph-container {
width: 100%;
height: 200px;
background-color: var(--md-default-bg-color);
}
Testing
Manual Testing
Test your changes with:
- Different documentation sizes:
- Small (< 20 pages)
- Medium (50-100 pages)
-
Large (> 100 pages)
-
Different configurations:
- Various depth settings
- Different physics parameters
-
Enabled/disabled features
-
Different devices:
- Desktop browsers (Chrome, Firefox, Safari)
- Mobile devices
-
Different screen sizes
-
Different themes:
- Light mode
- Dark mode
- Different Material theme colors
What to Test
- [ ] Mini graph appears correctly
- [ ] Full graph opens and closes
- [ ] Navigation works (clicking nodes)
- [ ] Hover effects work (if enabled)
- [ ] Drag and zoom work (if enabled)
- [ ] Mobile layout works
- [ ] Resize handling works
- [ ] No console errors
- [ ] Performance is acceptable
Documentation
Updating Documentation
If your change affects usage:
- Update relevant
.mdfiles indocs/ - Add examples if introducing new features
- Update configuration examples if needed
- Test documentation builds:
Documentation Style
- Use clear, concise language
- Provide code examples
- Include configuration snippets
- Add warnings/notes where appropriate
Use admonitions:
!!! note
This feature requires MkDocs 1.4+
!!! warning
High depth values can impact performance
!!! tip
Start with default settings and adjust
Submitting Pull Requests
PR Checklist
Before submitting:
- [ ] Code follows style guidelines
- [ ] Changes are tested manually
- [ ] Documentation is updated
- [ ] Commit messages are clear
- [ ] Branch is up to date with main
PR Description Template
## Description
Brief description of changes
## Type of Change
- [ ] Bug fix
- [ ] New feature
- [ ] Documentation update
- [ ] Performance improvement
## Testing
How were these changes tested?
## Screenshots
If applicable, add screenshots
## Checklist
- [ ] Code follows style guidelines
- [ ] Self-review completed
- [ ] Documentation updated
- [ ] No breaking changes (or documented)
Reporting Issues
Bug Reports
Include:
- Description: Clear description of the bug
- Steps to Reproduce: How to reproduce the issue
- Expected Behavior: What should happen
- Actual Behavior: What actually happens
- Environment:
- OS
- Python version
- MkDocs version
- Plugin version
- Browser (if frontend issue)
- Configuration: Your
mkdocs.ymlgraph config - Screenshots: If applicable
Feature Requests
Include:
- Description: What feature you'd like to see
- Use Case: Why this feature is needed
- Examples: Examples from other tools
- Alternatives: What you currently do instead
Code of Conduct
Our Standards
- Be respectful and inclusive
- Welcome newcomers
- Accept constructive criticism gracefully
- Focus on what's best for the community
Unacceptable Behavior
- Harassment of any kind
- Trolling or insulting comments
- Publishing others' private information
- Unprofessional conduct
Questions?
- Check existing Issues
- Read the Documentation
- Open a new issue for questions
License
By contributing, you agree that your contributions will be licensed under the GNU GPLv3 License.