Skip to content

Commit 6d24f91

Browse files
committed
docs: how-to add new annotations and docs
Adds add_new_annotations_and_extracted_docs.rst which documents how to add new annotation definitions and sphinx plugins to extract documentation to Readthedocs. ARCHBOM-1721
1 parent 722ded7 commit 6d24f91

2 files changed

Lines changed: 34 additions & 0 deletions

File tree

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
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

docs/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ Contents:
2929
:caption: Contrib Code
3030

3131
decisions/0001-config-and-tools
32+
contrib/how_to/add_new_annotations_and_extracted_docs
3233
contrib/sphinx_extensions
3334
contrib/how_to/documenting_django_settings
3435

0 commit comments

Comments
 (0)