|
1 | | -# Docs Contributions |
| 1 | +# Contribute to DataJoint Documentation |
2 | 2 |
|
3 | | -Docs contributors should be aware of the following extensions, with the corresponding |
4 | | -settings files, that were used in developing these docs: |
| 3 | +This is the home for DataJoint software documentation as hosted at https://datajoint.com/docs/core/datajoint-python/latest/ |
5 | 4 |
|
6 | | -- [MarkdownLinter](https://github.com/DavidAnson/markdownlint): |
| 5 | +## VSCode Linter Extensions and Settings |
| 6 | + |
| 7 | +The following extensions were used in developing these docs, with the corresponding |
| 8 | +settings files: |
| 9 | + |
| 10 | +- Recommended extensions are already specified in `.vscode/extensions.json`, it will ask you to install them when you open the project if you haven't installed them. |
| 11 | +- settings in `.vscode/settings.json` |
| 12 | +- [MarkdownLinter](https://marketplace.visualstudio.com/items?itemName=DavidAnson.vscode-markdownlint): |
7 | 13 | - `.markdownlint.yaml` establishes settings for various |
8 | 14 | [linter rules](https://github.com/DavidAnson/markdownlint/blob/main/doc/Rules.md) |
9 | 15 | - `.vscode/settings.json` formatting on save to fix linting |
10 | 16 |
|
11 | | -- [CSpell](https://github.com/streetsidesoftware/vscode-spell-checker): `cspell.json` |
| 17 | +- [CSpell](https://marketplace.visualstudio.com/items?itemName=streetsidesoftware.code-spell-checker): `cspell.json` |
12 | 18 | has various ignored words. |
13 | 19 |
|
14 | | -- [ReWrap](https://github.com/stkb/Rewrap/): `.vscode/settings.json` allows toggling |
| 20 | +- [ReWrap](https://marketplace.visualstudio.com/items?itemName=stkb.rewrap): `.vscode/settings.json` allows toggling |
15 | 21 | automated hard wrapping for files at 88 characters. This can also be keymapped to be |
16 | 22 | performed on individual paragraphs, see documentation. |
| 23 | + |
| 24 | +## With Virtual Environment |
| 25 | + |
| 26 | +conda |
| 27 | +```bash |
| 28 | +conda create -n djdocs -y |
| 29 | +conda activate djdocs |
| 30 | +``` |
| 31 | +venv |
| 32 | +```bash |
| 33 | +python -m venv .venv |
| 34 | +source .venv/bin/activate |
| 35 | +``` |
| 36 | + |
| 37 | +Then install the required packages: |
| 38 | +```bash |
| 39 | +# go to the repo's root directory to generate API docs |
| 40 | +# cd ~/datajoint-python/ |
| 41 | + |
| 42 | +# install mkdocs related requirements |
| 43 | +pip install -r ./docs/pip_requirements.txt |
| 44 | +# install datajoint, since API docs are generated from the package |
| 45 | +pip install -e .[dev] |
| 46 | +``` |
| 47 | + |
| 48 | +Run mkdocs at: http://127.0.0.1:8000/ |
| 49 | +```bash |
| 50 | +# go to the repo's root directory to generate API docs |
| 51 | +# cd ~/datajoint-python/ |
| 52 | + |
| 53 | +# It will automatically reload the docs when changes are made |
| 54 | +mkdocs serve --config-file ./docs/mkdocs.yaml |
| 55 | +``` |
| 56 | + |
| 57 | +## With Docker |
| 58 | + |
| 59 | +> We mostly use Docker to simplify docs deployment |
| 60 | +
|
| 61 | +Ensure you have `Docker` and `Docker Compose` installed. |
| 62 | + |
| 63 | +Then run the following: |
| 64 | +```bash |
| 65 | +# It will automatically reload the docs when changes are made |
| 66 | +MODE="LIVE" docker compose up --build |
| 67 | +``` |
| 68 | + |
| 69 | +Navigate to http://127.0.0.1:8000/ to preview the changes. |
| 70 | + |
| 71 | +This setup supports live-reloading so all that is needed is to save the markdown files |
| 72 | +and/or `mkdocs.yaml` file to trigger a reload. |
| 73 | + |
| 74 | +## Mkdocs Warning Explanation |
| 75 | + |
| 76 | +> TL;DR: We need to do it this way for hosting, please keep it as is. |
| 77 | +
|
| 78 | +```log |
| 79 | +INFO - Doc file 'index.md' contains an unrecognized relative link './develop', it was left as is. Did you mean |
| 80 | + 'develop.md'? |
| 81 | +``` |
| 82 | + |
| 83 | +- We use reverse proxy to proxy our docs sites, here is the proxy flow: |
| 84 | + - You hit `datajoint.com/*` on your browser |
| 85 | + - It'll bring you to the reverse proxy server first, that you wouldn't notice |
| 86 | + - when your URL ends with: |
| 87 | + - `/` is the company page |
| 88 | + - `/docs/` is the landing/navigation page hosted by datajoint/datajoint-docs's github pages |
| 89 | + - `/docs/core/datajoint-python/` is the actual docs site hosted by datajoint/datajoint-python's github pages |
| 90 | + - `/docs/elements/element-*/` is the actual docs site hosted by each element's github pages |
| 91 | + |
| 92 | + |
| 93 | +```log |
| 94 | +WARNING - Doc file 'query/operators.md' contains a link '../../../images/concepts-operators-restriction.png', but |
| 95 | + the target '../../images/concepts-operators-restriction.png' is not found among documentation files. |
| 96 | +``` |
| 97 | +- We use Github Pages to host our docs, the image references needs to follow the mkdocs's build directory structure, under `site/` directory once you run mkdocs. |
0 commit comments