|
| 1 | +********************************************** |
| 2 | +How to: Add new annotations and extracted docs |
| 3 | +********************************************** |
| 4 | + |
| 5 | +.. contents:: |
| 6 | + :depth: 1 |
| 7 | + :local: |
| 8 | + |
| 9 | +Example annotations and automated docs |
| 10 | +====================================== |
| 11 | + |
| 12 | +Annotations are a great way to keep documentation close to the code, but also be able to extract into documentation to be published on Readthedocs. |
| 13 | + |
| 14 | +As an example, we have added `feature toggle annotations to the edx-platform codebase`_. A `Readthedocs document with the edx-platform feature toggles`_ has been generated from them. |
| 15 | + |
| 16 | +.. _feature toggle annotations to the edx-platform codebase: https://github.com/edx/edx-platform/search?q=toggle_name |
| 17 | +.. _Readthedocs document with the edx-platform feature toggles: https://edx.readthedocs.io/projects/edx-platform-technical/en/latest/featuretoggles.html |
| 18 | + |
| 19 | +Add your own annotations and docs |
| 20 | +================================= |
| 21 | + |
| 22 | +The following steps need to be performed to document new types of annotations in edx-platform. Adapt the final steps as appropriate for other services. |
| 23 | + |
| 24 | +* Define a `new annotation format in code_annotations/contrib/config`_. See the feature toggle annotations as an example. |
| 25 | +* Create a `Sphinx extension to collect these annotations`_. You can base it on the featuretoggles and settings extensions. |
| 26 | +* Read and update :doc:`../sphinx_extensions`. |
| 27 | +* Add a new documentation page in the `edx-platform technical docs that will use this Sphinx extension`_. Adapt this step as needed for other services. |
| 28 | +* As required, add `custom linting for the new annotations to edx-lint`_. Again, follow the toggle and setting checkers as examples. |
| 29 | + |
| 30 | +.. _new annotation format in code_annotations/contrib/config: https://github.com/edx/code-annotations/tree/master/code_annotations/contrib/config |
| 31 | +.. _Sphinx extension to collect these annotations: https://github.com/edx/code-annotations/tree/master/code_annotations/contrib/sphinx/extensions |
| 32 | +.. _edx-platform technical docs that will use this Sphinx extension: https://github.com/edx/edx-platform/tree/master/docs/technical |
| 33 | +.. _custom linting for the new annotations to edx-lint: https://github.com/edx/edx-lint/blob/master/edx_lint/pylint/annotations_check.py |
0 commit comments