Skip to content

Commit 33489d7

Browse files
authored
Merge pull request #615 from chrisburr/more-docs
Add writing documentation tutorial
2 parents 40a3556 + 060ad8c commit 33489d7

File tree

3 files changed

+80
-5
lines changed

3 files changed

+80
-5
lines changed

docs/dev/how-to/write-docs.md

Whitespace-only changes.

docs/dev/tutorials/write-docs.md

Lines changed: 79 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,80 @@
1-
#TODO
1+
# Writing documentation
22

3-
serve the documentation locally
4-
denovio doc
5-
mkdocs
6-
mkdocs plugin
3+
This page guides you through how to contribute to the DiracX documentation to make significant changes.
4+
If you are only making a small edit, we recommend using the edit buttons on top right of each page of the documentation and using the GitHub web interface.
5+
6+
## Step 1: Think about who you're writing documentation for
7+
8+
In the DiracX documentation we have three distinct audiences:
9+
10+
- Developers: The people who edit the code of DIRAC itself.
11+
- Admins: The people who maintain installations DIRAC for one or more virtual organizations.
12+
- Users: The people who actually submit jobs and access data via DIRAC.
13+
14+
Some people fit into more that one group however when writing documentation you should always start by figuring which audience you expect to read it.
15+
16+
## Step 2: Think about what kind of documentation you're writing
17+
18+
In DiracX we follow the The Grand Unified Theory of Documentation for deciding how to separate documentation into four general categories.
19+
You can read more about the system [here](https://docs.divio.com/documentation-system/).
20+
At first it can be easy to mix up the various categories so uf you're uncertain about the type of documentation you want to write please open a GitHub issue to get advice.
21+
22+
## Step 3: Preparing your local environment
23+
24+
In order to go any further you'll need to have a [local development environment](../tutorials/getting-started.md).
25+
This website is build from a mixture of the `docs/` folders from the three repositories, combined with a custom [mkdocs plugin](https://github.com/DIRACGrid/mkdocs-diracx-plugin).
26+
If you're writing documentation for the DiracX web application or the DiracX helm chart you'll also need a local clone of [diracx-web](https://github.com/DIRACGrid/diracx-web) and/or [diracx-charts](https://github.com/DIRACGrid/diracx-charts).
27+
To configure `mkdocs` to use your local clones of those repos, edit the end of the `mkdocs.yml` as follows:
28+
29+
```diff title="<code>mkdocs.yml</code>"
30+
plugins:
31+
- diracx:
32+
repos:
33+
- - url: https://github.com/DIRACGrid/diracx-charts
34+
+ - url: /path/to/diracx-charts
35+
branch: master
36+
include:
37+
- docs
38+
- diracx
39+
- - url: https://github.com/DIRACGrid/diracx-web
40+
+ - url: /path/to/diracx-web
41+
branch: main
42+
include:
43+
- docs
44+
```
45+
46+
You can then start running a local `mkdocs` server with:
47+
48+
```bash
49+
pixi run mkdocs
50+
```
51+
52+
This command will print the URL you can connect to to view your locally running instance of the documentation, typically [http://127.0.0.1:8000/](http://127.0.0.1:8000/).
53+
When you make save changes to the pages will automatically reload.
54+
55+
## Step 4: Adding pages
56+
57+
To add a new page, create the markdown files in the appropriate directory and then add the file to the `nav:` section of the `mkdocs.yml`.
58+
59+
!!! note
60+
61+
The navigation structure is only stored in the base `diracx` repository, even for pages which are stored within the `diracx-charts`/`diracx-web` repositories.
62+
63+
## Step 5: Styling
64+
65+
The DiracX documentation is written in [markdown](https://daringfireball.net/projects/markdown/basics) with a variety of extensions to facilitate more complex styling.
66+
New documentation should be consistent with the style of the existing DiracX documentation and a reference on how to use the various markdown extensions can be found [here](https://squidfunk.github.io/mkdocs-material/reference/).
67+
68+
## Step 6: Storing images and other large files
69+
70+
As the documentation is stored in the main Git repositories it is important to avoid committing large binary files.
71+
To achieve this we have a a separate website for hosting these assets (https://diracx-docs-static.s3.cern.ch/assets).
72+
To add content, include the assets in your issue or pull request and the DIRAC developers will upload the files for you.
73+
74+
??? note "Adding content for DIRAC developers"
75+
76+
Assuming you have credentials configured according to the [CERN documentation](https://clouddocs.web.cern.ch/object_store/s3cmd.html) files can be added with:
77+
78+
```bash
79+
s3cmd put -P path/to/image.png s3://diracx-docs-static/assets/images/path/to/image/
80+
```

mkdocs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ theme:
3232
icon:
3333
logo: logo
3434
features:
35+
- content.action.edit
3536
- content.code.annotate
3637
- content.code.copy
3738
- content.tabs.link

0 commit comments

Comments
 (0)