Skip to content

Commit 56505b9

Browse files
committed
ADD-CAP: docuemntation sphinx page for devs
1 parent 3300036 commit 56505b9

File tree

3 files changed

+51
-8
lines changed

3 files changed

+51
-8
lines changed

doc/documentation.md

Lines changed: 46 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,52 @@
33

44
In DF we use `Sphinx` to generate the documentation. The documentation is written in `reStructuredText` and `Markdown` and the source files are located in the `doc` folder. The documentation is hosted on `ReadTheDocs` and is automatically updated when a new commit is pushed to the `main` branch.
55

6-
Documentation is autogenerated for:
6+
Follow these guides to contribute to the documentation whether you:
77

8-
- [GHComponents](gh_components.rst) for the DF Grasshopper plug-in
9-
- [Python API](diffCheck_PythonAPI) for the DF Python API
8+
- add a new [GHComponents](ghcomp_doc_g)
9+
- add/modify the [Python API](pyapi_doc_g)
10+
- add a new [tutorial](tutorial_doc_g)
1011

12+
---
13+
(ghcomp_doc_g)=
14+
## `GHComponent`'s docs
1115

12-
```{note}
13-
If you need to add a new page to the documentation (e.g. a [new tutorial](tutorials.rst)), you can do so by adding a new `.rst` file in the `doc` folder and linking it in the `index.rst` file.
16+
If you write a new [GHComponents](gh_components.rst) you will most probably already have created and filled a `metadata.json` file. DF uses this file to automatically generate the documentation for the GHComponents. The only thing you need to do is:
17+
* add a new `.rst` file with the name of the component like `gh_DFComponentName.rst`
18+
* add it to the `gh_components.rst` file's `list-table::`
19+
```{attention}
20+
The `list-table::` is organized in two columns so if not pair add simply two empty strings `-` to the end of the last entry.
21+
* add it to the `toctree::`
22+
23+
Our custom sphinx extension `sphinx_ghcomponent_parser` will automatically parse the `metadata.json` file and generate the documentation for the GHComponent✨✨.
24+
25+
26+
(pyapi_doc_g)=
27+
## `Python API`'s docs
28+
29+
For [Python API documentation](diffCheck_PythonAPI), we use `sphinx-apidoc` to automatically generate the API documentation so the only thing to do is to add beautiful docstrings to the Python code with the following reStructuredText (reST) format style:
30+
31+
```python
32+
def example_function(param1, param2):
33+
"""
34+
Summary of the function.
35+
36+
:param param1: Description of `param1`.
37+
:type param1: int
38+
:param param2: Description of `param2`.
39+
:type param2: str
40+
:return: Description of the return value.
41+
:rtype: bool
42+
"""
43+
return True
44+
```
45+
46+
(tutorial_doc_g)=
47+
## `DF Tutorial`'s docs
48+
49+
If you need to add a new page to the [tutorials](tutorials.rst) (e.g. a [new tutorial](tutorials.rst)), you can do so by adding a new `.rst` file in the `doc` folder and linking it in the `tutorials.rst` file's toctree:
50+
51+
```{eval-rst}
52+
.. literalinclude:: tutorials.rst
53+
:language: rst
54+
:lines: 6-14

doc/gh_components.rst

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,10 @@ DF has a Grasshopper_ plugin with a set of components that allows the user to in
6464
- .. image:: ../src/gh/components/DF_visualization_settings/icon.png
6565
- `gh_DFVisualizationSettings <gh_DFVisualizationSettings.html>`_
6666

67-
.. * - .. image:: ../src/gh/components/DF_tester/icon.png
68-
.. - `gh_DFTester <gh_DFTester.html>`_
67+
* - .. image:: ../src/gh/components/DF_tester/icon.png
68+
- `gh_DFTester <gh_DFTester.html>`_
69+
-
70+
-
6971

7072

7173

doc/tutorials.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ diffCheck tutorials
1111
pre-processing
1212
assembly_intro
1313
segmentation_intro
14-
compute_error_intro
14+
compute_error_intro

0 commit comments

Comments
 (0)