forked from GeoNode/geonode
-
Notifications
You must be signed in to change notification settings - Fork 0
/
documentation_guidelines.txt
273 lines (164 loc) · 7.23 KB
/
documentation_guidelines.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
.. _doc_guidelines:
==========================
How to write Documentation
==========================
GeoNode uses Restructured Text with `Sphinx <http://sphinx.pocoo.org>`_ . Writing style should follow the same policies as geoserver does in their `Documentation Style Guide <http://docs.geoserver.org/latest/en/docguide/style.html>`_
Sphinx Syntax
=============
This page contains syntax rules, tips, and tricks for using Sphinx and reStructuredText. For more information, please see:
* `RST Quick Reference <http://docutils.sourceforge.net/docs/user/rst/quickref.html#section-structure>`_
* `Comprehensive guide to reStructuredText <http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html>`_
* `Sphinx reStructuredText Primer <http://sphinx.pocoo.org/rest.html>`_
Basic markup
------------
A reStructuredText document is written in plain text. Without the need for complex formatting, one can be composed simply, just like one would any plain text document. For basic formatting, see this table:
.. list-table::
:widths: 30 40 30
* - **Format**
- **Syntax**
- **Output**
* - Italics
- ``*italics*`` (single asterisk)
- *italics*
* - Bold
- ``**bold**`` (double asterisk)
- **bold**
* - Monospace
- `` ``monospace`` `` (double back quote)
- ``monospace``
Sections, subtitles and titles
------------------------------
Use sections to break up long pages and to help Sphinx generate tables of contents.
The top of the page (i.e. the title) should have an equals sign (=) above and below::
==============
Camel Spotting
==============
Level 2 section headers should have an equals sign (=) below the section name with same length as name::
I am a level 2 header
=====================
Level 3 sections should have a single minus symbol (-)::
I am a level 3 header
---------------------
Level 4 sections should have a single dot,periol symbol (.)::
I am a level 4 header
.....................
Level 5 sections should have a single dot,periol symbol (.)::
I am a level 5 header
+++++++++++++++++++++
Page labels
-----------
**Ensure every page has a label.** For example if the page is named ``foo_bar.rst`` then the page should have the label at the top of the file (line1) ::
.. _foo_bar:
Other pages can then link to that page by using the following code::
:ref:`foo_bar`
.. _linking:
Linking
-------
Links to other pages should never be titled as "here". Sphinx makes this easy by automatically inserting the title of the linked document.
Using the following code::
:ref:`linking`
And here is the link in action :ref:`linking` to use the link place this code some where in your open file::
.. _linking:
To insert a link to an external website::
`Text of the link <http://docs.geoserver.org/latest/en/docguide/style.html>`_
The resulting link would look like this: `Text of the link <http://example.com>`_
Lists
-----
There are two types of lists, bulleted lists and numbered lists.
A **bulleted list** looks like this:
* An item
* Another item
* Yet another item
This is accomplished with the following code::
* An item
* Another item
* Yet another item
A **numbered list** looks like this:
#. First item
#. Second item
#. Third item
This is accomplished with the following code::
#. First item
#. Second item
#. Third item
Note that numbers are automatically generated, making it easy to add/remove items.
List-tables
-----------
Bulleted lists can sometimes be cumbersome and hard to follow. When dealing with a long list of items, use list-tables. For example, to talk about a list of options, create a table that looks like this:
.. list-table::
:widths: 20 80
:header-rows: 1
* - Shapes
- Description
* - Square
- Four sides of equal length, 90 degree angles
* - Rectangle
- Four sides, 90 degree angles
This is done with the following code::
.. list-table::
:widths: 20 80
:header-rows: 1
* - Shapes
- Description
* - Square
- Four sides of equal length, 90 degree angles
* - Rectangle
- Four sides, 90 degree angles
Notes and warnings
------------------
To emphasize something Sphinx has two ways, a note and a warning. They work the same, and only differ in their coloring. You should use notes and warnings sparingly, however, as adding emphasis to everything makes the emphasis less effective.
Here is an example of a note:
.. note:: This is a note.
This note is generated with the following code::
.. note:: This is a note.
Similarly, here is an example of a warning:
.. warning:: Beware of dragons.
This warning is generated by the following code::
.. warning:: Beware of dragons.
Images
------
Add images to your documentation when possible. Images, such as screen shots, are a very helpful way of making documentation understandable. When making screenshots, try to crop out unnecessary content (browser window, desktop, etc). Avoid scaling the images, as the Sphinx theme automatically resizes large images. It is also helpful to include a caption underneath the image.
.. figure:: img/logo.png
:align: center
*The GeoNode logo as shown on the homepage.*
This image is generated by the following code::
.. figure:: img/logo.png
:align: center
*The GeoNode logo as shown on the homepage.*
In this example, the image file exists in the same directory as the source page. If this is not the case, you can insert path information in the above command.
External files
--------------
Text snippets, large blocks of downloadable code, and even zip files or other binary sources can all be included as part of the documentation. To include files as part of the build process, use the following syntax::
:download:`An external file <readme.txt>`
The result of this code will generate a standard link to an :download:`external file <readme.txt>`
Reference files and paths
-------------------------
Use the following syntax to reference files and paths::
:file:`myfile.txt`
This will output: :file:`myfile.txt`.
You can reference paths in the same way::
:file:`path/to/myfile.txt`
This will output: :file:`path/to/myfile.txt`.
For Windows paths, use double backslashes::
:file:`C:\\myfile.txt`
This will output: :file:`C:\\myfile.txt`.
If you want to reference a non-specific path or file name::
:file:`{your/own/path/to}/myfile.txt`
This will output: :file:`{your/own/path/to}/myfile.txt`
Reference commands
------------------
Reference commands (such as :command:`make`) with the following syntax::
:command:`make`
Reference an element in a GUI
-----------------------------
Use the following syntax to direct a user to click a link or look to a certain area of the GUI::
:guilabel:`Main Menu`
This will output: :guilabel:`Main Menu`.
Menu traversal
--------------
Direct a user through a menu with the following syntax::
:menuselection:`Start Menu --> Programs --> Geonode`
This will output :menuselection:`Start Menu --> Programs --> Geonode`.
Show Source
-----------
Every page in the GeoNode documentation has a link for ``Show Source`` under the Table of Contents on the right side of the page. This allows for easy reverse engineering of unfamiliar markup. When in doubt, look at the source!