@@ -119,6 +119,8 @@ The sections of a function's docstring are:
119
119
120
120
"""
121
121
122
+ .. highlight :: rst
123
+
122
124
2. **Deprecation warning **
123
125
124
126
A section (use if applicable) to warn users that the object is deprecated.
@@ -276,46 +278,46 @@ The sections of a function's docstring are:
276
278
277
279
10. **Warnings **
278
280
279
- An optional section with cautions to the user in free text/reST.
281
+ An optional section with cautions to the user in free text/reST.
280
282
281
283
11. **See Also **
282
284
283
- An optional section used to refer to related code. This section
284
- can be very useful, but should be used judiciously. The goal is to
285
- direct users to other functions they may not be aware of, or have
286
- easy means of discovering (by looking at the module docstring, for
287
- example). Routines whose docstrings further explain parameters
288
- used by this function are good candidates.
285
+ An optional section used to refer to related code. This section
286
+ can be very useful, but should be used judiciously. The goal is to
287
+ direct users to other functions they may not be aware of, or have
288
+ easy means of discovering (by looking at the module docstring, for
289
+ example). Routines whose docstrings further explain parameters
290
+ used by this function are good candidates.
289
291
290
- As an example, for ``numpy.mean `` we would have::
292
+ As an example, for ``numpy.mean `` we would have::
291
293
292
- See Also
293
- --------
294
- average : Weighted average
294
+ See Also
295
+ --------
296
+ average : Weighted average
295
297
296
- When referring to functions in the same sub-module, no prefix is
297
- needed, and the tree is searched upwards for a match.
298
+ When referring to functions in the same sub-module, no prefix is
299
+ needed, and the tree is searched upwards for a match.
298
300
299
- Prefix functions from other sub-modules appropriately. E.g.,
300
- whilst documenting the ``random `` module, refer to a function in
301
- ``fft `` by
301
+ Prefix functions from other sub-modules appropriately. E.g.,
302
+ whilst documenting the ``random `` module, refer to a function in
303
+ ``fft `` by
302
304
303
- ::
305
+ ::
304
306
305
- fft.fft2 : 2-D fast discrete Fourier transform
307
+ fft.fft2 : 2-D fast discrete Fourier transform
306
308
307
- When referring to an entirely different module::
309
+ When referring to an entirely different module::
308
310
309
- scipy.random.norm : Random variates, PDFs, etc.
311
+ scipy.random.norm : Random variates, PDFs, etc.
310
312
311
- Functions may be listed without descriptions, and this is
312
- preferable if the functionality is clear from the function name::
313
+ Functions may be listed without descriptions, and this is
314
+ preferable if the functionality is clear from the function name::
313
315
314
- See Also
315
- --------
316
- func_a : Function a with its description.
317
- func_b, func_c_, func_d
318
- func_e
316
+ See Also
317
+ --------
318
+ func_a : Function a with its description.
319
+ func_b, func_c_, func_d
320
+ func_e
319
321
320
322
12. **Notes **
321
323
@@ -393,6 +395,8 @@ The sections of a function's docstring are:
393
395
docstring, the table markup will be broken by numpydoc processing. See
394
396
`numpydoc issue #130 <https://github.com/numpy/numpydoc/issues/130 >`_
395
397
398
+ .. highlight :: pycon
399
+
396
400
14. **Examples **
397
401
398
402
An optional section for examples, using the `doctest
@@ -464,6 +468,7 @@ The sections of a function's docstring are:
464
468
`matplotlib.sphinxext.plot_directive ` is loaded as a Sphinx extension in
465
469
``conf.py ``.
466
470
471
+ .. highlight :: rst
467
472
468
473
Documenting classes
469
474
-------------------
@@ -501,7 +506,9 @@ In general, it is not necessary to list class methods. Those that are
501
506
not part of the public API have names that start with an underscore.
502
507
In some cases, however, a class may have a great many methods, of
503
508
which only a few are relevant (e.g., subclasses of ndarray). Then, it
504
- becomes useful to have an additional **Methods ** section::
509
+ becomes useful to have an additional **Methods ** section:
510
+
511
+ .. code-block :: python
505
512
506
513
class Photo (ndarray ):
507
514
"""
0 commit comments