|
3 | 3 |
|
4 | 4 | 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.
|
5 | 5 |
|
6 |
| -Documentation is autogenerated for: |
| 6 | +Follow these guides to contribute to the documentation whether you: |
7 | 7 |
|
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) |
10 | 11 |
|
| 12 | +--- |
| 13 | +(ghcomp_doc_g)= |
| 14 | +## `GHComponent`'s docs |
11 | 15 |
|
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 |
0 commit comments