Skip to content

Commit 0e4923e

Browse files
authored
Fix markup in format.rst. (#193)
This ensures that 1) the various literal blocks are properly highlighted as rst or python depending on their contents, 2) the documentation for the Warnings and See Also sections does not appear as quote blocks.
2 parents 659e43f + 5536ee8 commit 0e4923e

File tree

1 file changed

+35
-28
lines changed

1 file changed

+35
-28
lines changed

doc/format.rst

Lines changed: 35 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,8 @@ The sections of a function's docstring are:
119119

120120
"""
121121

122+
.. highlight:: rst
123+
122124
2. **Deprecation warning**
123125

124126
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:
276278

277279
10. **Warnings**
278280

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.
280282

281283
11. **See Also**
282284

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.
289291

290-
As an example, for ``numpy.mean`` we would have::
292+
As an example, for ``numpy.mean`` we would have::
291293

292-
See Also
293-
--------
294-
average : Weighted average
294+
See Also
295+
--------
296+
average : Weighted average
295297

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.
298300

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
302304

303-
::
305+
::
304306

305-
fft.fft2 : 2-D fast discrete Fourier transform
307+
fft.fft2 : 2-D fast discrete Fourier transform
306308

307-
When referring to an entirely different module::
309+
When referring to an entirely different module::
308310

309-
scipy.random.norm : Random variates, PDFs, etc.
311+
scipy.random.norm : Random variates, PDFs, etc.
310312

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::
313315

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
319321

320322
12. **Notes**
321323

@@ -393,6 +395,8 @@ The sections of a function's docstring are:
393395
docstring, the table markup will be broken by numpydoc processing. See
394396
`numpydoc issue #130 <https://github.com/numpy/numpydoc/issues/130>`_
395397

398+
.. highlight:: pycon
399+
396400
14. **Examples**
397401

398402
An optional section for examples, using the `doctest
@@ -464,6 +468,7 @@ The sections of a function's docstring are:
464468
`matplotlib.sphinxext.plot_directive` is loaded as a Sphinx extension in
465469
``conf.py``.
466470

471+
.. highlight:: rst
467472

468473
Documenting classes
469474
-------------------
@@ -501,7 +506,9 @@ In general, it is not necessary to list class methods. Those that are
501506
not part of the public API have names that start with an underscore.
502507
In some cases, however, a class may have a great many methods, of
503508
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
505512
506513
class Photo(ndarray):
507514
"""

0 commit comments

Comments
 (0)