|
| 1 | +# Contributing to the Collaborative Distributed Science Guide |
| 2 | + |
| 3 | +Thank you for your interest in contributing to the Collaborative Distributed Science Guide! This document outlines the standards and guidelines for contributing to this template repository. |
| 4 | + |
| 5 | +## Overview |
| 6 | + |
| 7 | +The Collaborative Distributed Science Guide is built with [MkDocs Material](https://squidfunk.github.io/mkdocs-material/) and deployed via GitHub Pages. All documentation is written in Markdown and follows specific formatting standards to ensure consistent rendering and maintainability. |
| 8 | + |
| 9 | +This is a template repository designed to be forked and customized by different organizations for their collaborative science documentation needs. |
| 10 | + |
| 11 | +## Getting Started |
| 12 | + |
| 13 | +### Local Development Setup |
| 14 | + |
| 15 | +1. Clone the repository |
| 16 | +2. Set up a virtual environment (recommended): |
| 17 | + |
| 18 | + ```bash |
| 19 | + python -m venv .venv |
| 20 | + source .venv/bin/activate # On Windows: .venv\Scripts\activate |
| 21 | + ``` |
| 22 | + |
| 23 | + For more detailed environment setup options (including conda), see our [Virtual Environments guide](docs/wiki-guide/Virtual-Environments.md). |
| 24 | + |
| 25 | +3. Install dependencies: |
| 26 | + |
| 27 | + ```bash |
| 28 | + pip install -r requirements.txt |
| 29 | + ``` |
| 30 | + |
| 31 | +4. Serve the site locally: |
| 32 | + |
| 33 | + ```bash |
| 34 | + mkdocs serve |
| 35 | + ``` |
| 36 | + |
| 37 | +5. View the site at <http://127.0.0.1:8000/Collaborative-distributed-science-guide/> |
| 38 | + |
| 39 | +### Testing Changes |
| 40 | + |
| 41 | +Always test your changes locally with `mkdocs serve` before submitting a PR to ensure: |
| 42 | + |
| 43 | +- Content renders correctly |
| 44 | +- Links work properly |
| 45 | +- Formatting appears as intended |
| 46 | +- No build errors occur |
| 47 | + |
| 48 | +## Documentation Standards |
| 49 | + |
| 50 | +### Markdown Formatting |
| 51 | + |
| 52 | +#### Indentation for Nested Lists |
| 53 | + |
| 54 | +- **Use 4 spaces for nested list items** (not 2 spaces) |
| 55 | +- This requirement exists due to Python-Markdown compatibility issues with MkDocs |
| 56 | +- 2-space indentation causes nested lists to not render properly in the final HTML |
| 57 | + |
| 58 | +**Correct:** |
| 59 | + |
| 60 | +```markdown |
| 61 | +- [ ] Main item |
| 62 | + - [ ] Nested item |
| 63 | + - [ ] Another nested item |
| 64 | +``` |
| 65 | + |
| 66 | +**Incorrect:** |
| 67 | + |
| 68 | +```markdown |
| 69 | +- [ ] Main item |
| 70 | + - [ ] Nested item (will not render as nested) |
| 71 | +``` |
| 72 | + |
| 73 | +#### General Formatting |
| 74 | + |
| 75 | +- Remove trailing whitespace |
| 76 | +- Use consistent line breaks |
| 77 | +- Follow the project's `.markdownlint.json` configuration |
| 78 | +- Ensure proper heading hierarchy (don't skip heading levels) |
| 79 | + |
| 80 | +### License Format Requirements |
| 81 | + |
| 82 | +#### Hugging Face YAML Frontmatter |
| 83 | + |
| 84 | +When specifying licenses in Hugging Face dataset/model card YAML sections, **always use lowercase**: |
| 85 | + |
| 86 | +**Correct:** |
| 87 | + |
| 88 | +```yaml |
| 89 | +license: cc0-1.0 |
| 90 | +``` |
| 91 | +
|
| 92 | +**Incorrect:** |
| 93 | +
|
| 94 | +```yaml |
| 95 | +license: CC0-1.0 # Will cause issues with Hugging Face platform |
| 96 | +``` |
| 97 | +
|
| 98 | +This is a platform-specific requirement for Hugging Face compatibility. |
| 99 | +
|
| 100 | +#### License References in Text |
| 101 | +
|
| 102 | +In prose text, you may use standard capitalization (e.g., "CC0", "MIT"), but YAML frontmatter must be lowercase. |
| 103 | +
|
| 104 | +### File Organization |
| 105 | +
|
| 106 | +- Documentation content goes in `docs/` |
| 107 | +- Wiki-style guides go in `docs/wiki-guide/` |
| 108 | +- Images and assets are organized in subdirectories within `docs/` |
| 109 | +- Templates use descriptive filenames with consistent naming patterns |
| 110 | + |
| 111 | +### Custom Macros |
| 112 | + |
| 113 | +The project includes custom MkDocs macros defined in `main.py`: |
| 114 | + |
| 115 | +- `include_file_as_code()` - Embeds file content as code blocks |
| 116 | +- When using macros, ensure proper syntax and test rendering locally |
| 117 | + |
| 118 | +## Contribution Process |
| 119 | + |
| 120 | +1. **Create an issue** describing the change (for significant additions) |
| 121 | +2. **Create a feature branch** from `dev` |
| 122 | +3. **Make your changes** following the standards above |
| 123 | +4. **Test locally** with `mkdocs serve` |
| 124 | +5. **Run linting** to ensure formatting consistency |
| 125 | +6. **Submit a pull request** with: |
| 126 | + - Clear description of changes |
| 127 | + - Reference to related issue |
| 128 | + - Screenshots if UI changes are involved |
| 129 | + |
| 130 | +### Pull Request Guidelines |
| 131 | + |
| 132 | +- Keep PRs focused on a single topic when possible |
| 133 | +- Follow commit message conventions (see below) |
| 134 | +- Update navigation in `mkdocs.yaml` if adding new pages |
| 135 | +- Ensure all links work correctly |
| 136 | +- Test that the site builds without errors |
| 137 | + |
| 138 | +### Commit Message Guidelines |
| 139 | + |
| 140 | +The most important aspects of good commit messages are that they should be **descriptive** and **atomic** (each commit should represent a single logical change). Additionally: |
| 141 | + |
| 142 | +- **Keep the first line short**: Limit the subject line to 50 characters or less |
| 143 | +- **Use the imperative mood**: "Add feature" not "Added feature" or "Adds feature" |
| 144 | +- **Separate subject from body**: Use a blank line between the subject line and detailed description |
| 145 | + |
| 146 | +#### Conventional Commits Recommendation |
| 147 | + |
| 148 | +We recommend following the [Conventional Commits](https://www.conventionalcommits.org/) format for commit messages: |
| 149 | + |
| 150 | +**Format:** `type(scope): description` |
| 151 | + |
| 152 | +**Common types:** |
| 153 | + |
| 154 | +- `feat`: New feature or content addition |
| 155 | +- `fix`: Bug fix or correction |
| 156 | +- `docs`: Documentation updates |
| 157 | +- `style`: Formatting changes (no content changes) |
| 158 | +- `refactor`: Code/content restructuring without changing functionality |
| 159 | +- `chore`: Maintenance tasks, tooling updates |
| 160 | + |
| 161 | +**Examples:** |
| 162 | + |
| 163 | +```bash |
| 164 | +feat(fair-guide): add data repository checklist |
| 165 | +fix(templates): correct license format in HF dataset card |
| 166 | +docs(contributing): add conventional commit guidelines |
| 167 | +style(checklists): fix markdown formatting and indentation |
| 168 | +chore: update mkdocs dependencies |
| 169 | +``` |
| 170 | + |
| 171 | +**Scope** is optional but helpful for larger changes. Use the guide section or file type being modified. |
| 172 | + |
| 173 | +**Note:** Since we use squash merges, strict adherence to this format isn't required, but descriptive and atomic commits help maintain a clear project history. |
| 174 | + |
| 175 | +## Quality Assurance |
| 176 | + |
| 177 | +### Linting |
| 178 | + |
| 179 | +The project uses [markdownlint](https://github.com/DavidAnson/markdownlint) with configuration in `.markdownlint.json`. Key settings: |
| 180 | + |
| 181 | +- 4-space indentation for lists (`MD007`) |
| 182 | +- No hard tab restrictions disabled |
| 183 | +- Line length restrictions disabled (`MD013`) |
| 184 | + |
| 185 | +### Content Review |
| 186 | + |
| 187 | +When reviewing content: |
| 188 | + |
| 189 | +- Verify accuracy of technical information |
| 190 | +- Check for consistency with existing guides |
| 191 | +- Ensure proper cross-referencing between related pages |
| 192 | +- Validate that external links are current and working |
| 193 | + |
| 194 | +## Platform-Specific Considerations |
| 195 | + |
| 196 | +### Hugging Face Integration |
| 197 | + |
| 198 | +- Dataset and model card templates must follow HF specifications |
| 199 | +- YAML frontmatter formatting is critical for platform compatibility |
| 200 | +- License identifiers must match HF's expected format |
| 201 | + |
| 202 | +### MkDocs/Python-Markdown |
| 203 | + |
| 204 | +- Nested list rendering requires specific indentation |
| 205 | +- Some Markdown extensions may behave differently than GitHub Flavored Markdown |
| 206 | +- Always test complex formatting locally |
| 207 | + |
| 208 | +## Getting Help |
| 209 | + |
| 210 | +- Open an [issue](https://github.com/Imageomics/Collaborative-distributed-science-guide/issues) for questions or problems |
| 211 | +- Reference existing guides and templates for examples |
| 212 | +- Check the [MkDocs Material documentation](https://squidfunk.github.io/mkdocs-material/) for advanced features |
| 213 | + |
| 214 | +## Code of Conduct |
| 215 | + |
| 216 | +All contributors must adhere to our [Code of Conduct](docs/CODE_OF_CONDUCT.md) and organizational principles of engagement. |
| 217 | + |
| 218 | +--- |
| 219 | + |
| 220 | +Thank you for helping improve the Collaborative Distributed Science Guide! Your contributions help make collaborative scientific computing more accessible and effective. |
0 commit comments