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