Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e8f41a1

Browse files
committed
Expanded on documentation guidelines
svn path=/trunk/matplotlib/; revision=5548
1 parent ffa4f00 commit e8f41a1

2 files changed

Lines changed: 111 additions & 6 deletions

File tree

doc/devel/documenting_mpl.rst

Lines changed: 106 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ arguments to build everything.
3333
The output produced by Sphinx can be configured by editing the `conf.py`
3434
file located in the `doc/`.
3535

36+
3637
Organization of matplotlib's documentation
3738
==========================================
3839

@@ -50,6 +51,7 @@ statement, such as::
5051

5152
.. include:: ../../TODO
5253

54+
5355
Formatting
5456
==========
5557

@@ -61,6 +63,20 @@ working with Sphinx in general. Here are a few additional things to keep in mind
6163
other semantic markup. For example, when referring to external files, use the
6264
``:file:`` directive.
6365

66+
* Function arguments and keywords should be referred to using the *emphasis*
67+
role. This will keep matplotlib's documentation consistant with Python's
68+
documentation::
69+
70+
Here is a description of *argument*
71+
72+
Please do not use the `default role`::
73+
74+
Please do not describe `argument` like this.
75+
76+
nor the ``literal`` role::
77+
78+
Please do not describe ``argument`` like this.
79+
6480
* Sphinx does not support tables with column- or row-spanning cells for
6581
latex output. Such tables can not be used when documenting matplotlib.
6682

@@ -92,9 +108,95 @@ working with Sphinx in general. Here are a few additional things to keep in mind
92108

93109
In [69]: lines = plot([1,2,3])
94110

111+
* Footnotes [#]_ can be added using ``[#]_``, followed later by::
112+
113+
.. rubric:: Footnotes
114+
115+
.. [#]
116+
117+
.. rubric:: Footnotes
118+
119+
.. [#] For example.
120+
121+
* Use the *note* and *warning* directives, sparingly, to draw attention to
122+
important comments::
123+
124+
.. note::
125+
Here is a note
126+
127+
yields:
128+
129+
.. note::
130+
here is a note
131+
132+
also:
133+
134+
.. warning::
135+
here is a warning
136+
137+
* Use the *deprecated* directive when appropriate::
138+
139+
.. deprecated:: 0.98
140+
This feature is obsolete, use something else.
141+
142+
yields:
143+
144+
.. deprecated:: 0.98
145+
This feature is obsolete, use something else.
146+
147+
* Use the *versionadded* and *versionchanged* directives, which have similar
148+
syntax to the *deprecated* role::
149+
150+
.. versionadded:: 0.98
151+
The transforms have been completely revamped.
152+
153+
.. versionadded:: 0.98
154+
The transforms have been completely revamped.
155+
156+
* Use the *seealso* directive, for example::
157+
158+
.. seealso::
159+
160+
Using ReST :ref:`emacs-helpers`:
161+
One example
162+
163+
A bit about :ref:`referring-to-mpl-docs`:
164+
One more
165+
166+
yields:
167+
168+
.. seealso::
169+
170+
Using ResT :ref:`emacs-helpers`:
171+
One example
172+
173+
A bit about :ref:`referring-to-mpl-docs`:
174+
One more
175+
176+
* Please keep the :ref:`glossary` in mind when writing documentation. You can
177+
create a references to a term in the glossary with the ``:term:`` role.
178+
179+
* The autodoc extension will handle index entries for the API, but additional
180+
entries in the index_ need to be explicitly added.
181+
95182
.. _documentation: http://sphinx.pocoo.org/contents.html
96183
.. _`inline markup`: http://sphinx.pocoo.org/markup/inline.html
184+
.. _index: http://sphinx.pocoo.org/markup/para.html#index-generating-markup
97185

186+
Docstrings
187+
----------
188+
189+
In addition to the aforementioned formatting suggestions:
190+
191+
* Please limit the text width of docstrings to 70 characters.
192+
193+
* Keyword arguments should be described using a definition list.
194+
195+
.. note::
196+
matplotlib makes extensive use of keyword arguments as pass-through
197+
arguments, there are a many cases where a table is used in place of a
198+
definition list for autogenerated sections of docstrings.
199+
98200

99201
Figures
100202
=======
@@ -139,7 +241,6 @@ taken, these figures can be included in the usual way::
139241
:include-source
140242

141243

142-
143244
.. _referring-to-mpl-docs:
144245

145246
Referring to mpl documents
@@ -166,8 +267,6 @@ directory, I use the symlink directory. For example, from
166267
.. literalinclude:: ../mpl_data/matplotlibrc
167268

168269

169-
170-
171270
.. _internal-section-refs:
172271

173272
Internal section references
@@ -196,7 +295,7 @@ is better than::
196295
In addition, since underscores are widely used by Sphinx itself, let's prefer
197296
hyphens to separate words.
198297

199-
.. _emacs-helpers:
298+
200299

201300
Section names, etc
202301
==================
@@ -205,6 +304,9 @@ For everything but top level chapters, please use ``Upper lower`` for
205304
section titles, eg ``Possible hangups`` rather than ``Possible
206305
Hangups``
207306

307+
308+
.. _emacs-helpers:
309+
208310
Emacs helpers
209311
=============
210312

doc/glossary/index.rst

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1-
########
1+
2+
.. _glossary:
3+
4+
********
25
Glossary
3-
########
6+
********
47

58
.. glossary::
69

0 commit comments

Comments
 (0)