Skip to content

Commit a92330c

Browse files
erlend-aaslandJelleZijlstraCAM-Gerlach
authored
Clarify when to use versionadded and versionchanged (#1264)
Clarify when to use the versionadded vs versionchanged directives in doc markup Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com> Co-authored-by: C.A.M. Gerlach <CAM.Gerlach@Gerlach.CAM>
1 parent d4552d0 commit a92330c

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

documentation/markup.rst

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -373,6 +373,8 @@ As you can see, the module-specific markup consists of two directives, the
373373
in overview files.
374374

375375

376+
.. _information-units:
377+
376378
Information units
377379
-----------------
378380

@@ -1019,13 +1021,20 @@ units as well as normal text:
10191021
feature, or a part of it, to the library or C API. When this applies to an
10201022
entire module, it should be placed at the top of the module section before
10211023
any prose.
1024+
When adding a new API :ref:`with a directive <information-units>`
1025+
(``class``, ``attribute``, ``function``, ``method``, ``c:type``, etc),
1026+
a ``versionadded`` should be included at the end of its description block.
10221027

10231028
The first argument must be given and is the version in question. The second
10241029
argument is optional and can be used to describe the details of the feature.
10251030

10261031
Example::
10271032

1028-
.. versionadded:: 3.5
1033+
.. function:: func()
1034+
1035+
Return foo and bar.
1036+
1037+
.. versionadded:: 3.5
10291038

10301039
.. describe:: versionchanged
10311040

@@ -1035,8 +1044,12 @@ units as well as normal text:
10351044

10361045
Example::
10371046

1038-
.. versionchanged:: 3.1
1039-
The *spam* parameter was added.
1047+
.. function:: func(spam=False)
1048+
1049+
Return foo and bar, optionally with *spam* applied.
1050+
1051+
.. versionchanged:: 3.6
1052+
Added the *spam* parameter.
10401053

10411054
Note that there should be no blank line between the directive head and the
10421055
explanation; this is to make these blocks visually continuous in the markup.

0 commit comments

Comments
 (0)