Skip to content

Commit 735c01d

Browse files
authored
Documentation: Restructure the contributing docs by creating a new page for reStructuredText usage (#74)
2 parents f6816e2 + 71b51dd commit 735c01d

File tree

3 files changed

+161
-158
lines changed

3 files changed

+161
-158
lines changed

docs/contributing/index.rst

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -248,9 +248,13 @@ To build the documentation on your local machine, follow these steps:
248248
249249
make run
250250
251+
Other guidelines
252+
----------------
253+
254+
Please, also follow these guidelines when contributing to the documentation:
251255

252256
.. toctree::
253-
:maxdepth: 2
254-
:hidden:
257+
:maxdepth: 1
255258

256259
Style guide <style_guide.rst>
260+
reStructuredText usage <restructuredtext_usage.rst>
Lines changed: 155 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,155 @@
1+
reStructuredText usage
2+
======================
3+
4+
This documentation is written in ``reStructuredText``. The following are the common syntax elements with examples:
5+
6+
External links
7+
--------------
8+
9+
To create an external link, use the following syntax:
10+
11+
.. code-block:: rst
12+
13+
`Link text <https://example.com>`_
14+
15+
Link to sections in the documentation
16+
-------------------------------------
17+
18+
To link to a section within the documentation, create a reference at the top of that section using this syntax:
19+
20+
.. code-block:: rst
21+
22+
.. _section-name:
23+
24+
Section title
25+
=============
26+
27+
Then, link to that section using the following syntax:
28+
29+
.. code-block:: rst
30+
31+
:ref:`section-name`
32+
33+
Headings
34+
--------
35+
Ensure your headings are concise and descriptive. Use sentence case for headings by capitalizing only the first word. If a heading includes an official term, retain its original capitalization.
36+
37+
Also, use heading levels in sequential order without skipping. For example, progress from H1 to H2 to H3. Avoid using headings beyond H3. Instead, structure content with numbered or bullet lists.
38+
39+
Also, underlines must be the same length as the title or heading. Use sentence case for headings by capitalizing only the first word:
40+
41+
1. Heading one (H1):
42+
43+
.. code-block:: rst
44+
45+
Heading one - page title
46+
========================
47+
48+
2. Heading two (H2):
49+
50+
.. code-block:: rst
51+
52+
Heading two - section title
53+
---------------------------
54+
55+
3. Heading three (H3):
56+
57+
.. code-block:: rst
58+
59+
Heading three - major subsection
60+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
61+
62+
Paragraphs
63+
----------
64+
65+
Separate paragraphs with a blank line without indentation.
66+
67+
Lists
68+
-----
69+
70+
Lists can be numbered or unnumbered. For more information, see :ref:`lists`. You can also nest them to create different hierarchy levels:
71+
72+
1. **Unnumbered lists:** To create an unordered list, start each item with an **asterisk (*)** followed by a space. Ensure that there is a blank line between the items and before and after the list:
73+
74+
.. code-block:: rst
75+
76+
* Item 1
77+
78+
* Item 2
79+
80+
* Item 3
81+
82+
2. **Numbered lists:** To create an ordered list, start each item with a number followed by a period and a space. Ensure that there is a blank line between the items and before and after the list:
83+
84+
.. code-block:: rst
85+
86+
1. Item 1
87+
88+
2. Item 2
89+
90+
3. Item 3
91+
92+
3. **Nested lists:** For nested unnumbered lists, indent each sub-item level using four spaces. Use the same asterisk (`*`) syntax for all levels. Also, ensure that there's a blank line between the items and before and after the list:
93+
94+
.. code-block:: rst
95+
96+
* Item 1
97+
* Sub-item 1
98+
* Sub-item 2
99+
100+
* Item 2
101+
* Sub-item 1
102+
* Sub-item 2
103+
104+
Code snippets
105+
-------------
106+
107+
Use the ``.. code-block::`` directive to display multi-line code snippets. Specify the file format or programming language after the directive to turn on proper syntax highlighting. For example:
108+
109+
.. code-block:: rst
110+
111+
.. code-block:: py
112+
113+
def hello_world():
114+
print("Hello, World!")
115+
116+
Inline code
117+
-----------
118+
119+
For short pieces of code within a sentence, use double **backticks (``)**. This helps distinguish the code from regular text. For example:
120+
121+
.. code-block:: rst
122+
123+
Use the ``print()`` function to display output.
124+
125+
Tables
126+
------
127+
128+
You can choose to use either grid tables or simple tables. Each type has its own syntax and use cases:
129+
130+
1. **Grid tables:** Grid tables give you full control over the layout and structure of your table. You create them by manually drawing the cell grid using characters like **+**, **-**, and **|**.
131+
132+
Here’s an example of a grid table:
133+
134+
.. code-block:: rst
135+
136+
+-----------------+-----------------+
137+
| Header 1 | Header 2 |
138+
+=================+=================+
139+
| Row 1, Column 1 | Row 1, Column 2 |
140+
+-----------------+-----------------+
141+
| Row 2, Column 1 | Row 2, Column 2 |
142+
+-----------------+-----------------+
143+
144+
2. **Simple tables:** Simple tables are easier to create but come with some limitations. They require at least two rows, and the cells in the first column cannot span multiple lines.
145+
146+
Here’s an example of a simple table:
147+
148+
.. code-block:: rst
149+
150+
=============== ===============
151+
Header 1 Header 2
152+
=============== ===============
153+
Row 1, Column 1 Row 1, Column 2
154+
Row 2, Column 1 Row 2, Column 2
155+
=============== ===============

docs/contributing/style_guide.rst

Lines changed: 0 additions & 156 deletions
Original file line numberDiff line numberDiff line change
@@ -129,159 +129,3 @@ Use bullet lists for items that do not follow a specific order. For example:
129129
* Common error messages
130130

131131
Avoid overly complex nesting in lists. If a list becomes too deep, consider breaking it into smaller sections. Ensure all items in a list follow the same grammatical structure to maintain clarity.
132-
133-
reStructuredText usage
134-
----------------------
135-
136-
This documentation is written in ``reStructuredText``. The following are the common syntax elements with examples:
137-
138-
External links
139-
~~~~~~~~~~~~~~
140-
141-
To create an external link, use the following syntax:
142-
143-
.. code-block:: rst
144-
145-
`Link text <https://example.com>`_
146-
147-
Link to sections in the documentation
148-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
149-
150-
To link to a section within the documentation, create a reference at the top of that section using this syntax:
151-
152-
.. code-block:: rst
153-
154-
.. _section-name:
155-
156-
Section title
157-
=============
158-
159-
Then, link to that section using the following syntax:
160-
161-
.. code-block:: rst
162-
163-
:ref:`section-name`
164-
165-
Headings
166-
~~~~~~~~
167-
Ensure your headings are concise and descriptive. Use sentence case for headings by capitalizing only the first word. If a heading includes an official term, retain its original capitalization.
168-
169-
Also, use heading levels in sequential order without skipping. For example, progress from H1 to H2 to H3. Avoid using headings beyond H3. Instead, structure content with numbered or bullet lists.
170-
171-
Also, underlines must be the same length as the title or heading. Use sentence case for headings by capitalizing only the first word:
172-
173-
1. Heading one (H1):
174-
175-
.. code-block:: rst
176-
177-
Heading one - page title
178-
========================
179-
180-
2. Heading two (H2):
181-
182-
.. code-block:: rst
183-
184-
Heading two - section title
185-
---------------------------
186-
187-
3. Heading three (H3):
188-
189-
.. code-block:: rst
190-
191-
Heading three - major subsection
192-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
193-
194-
Paragraphs
195-
~~~~~~~~~~
196-
197-
Separate paragraphs with a blank line without indentation.
198-
199-
Lists
200-
~~~~~
201-
202-
Lists can be numbered or unnumbered. For more information, see :ref:`lists`. You can also nest them to create different hierarchy levels:
203-
204-
1. **Unnumbered lists:** To create an unordered list, start each item with an **asterisk (*)** followed by a space. Ensure that there is a blank line between the items and before and after the list:
205-
206-
.. code-block:: rst
207-
208-
* Item 1
209-
210-
* Item 2
211-
212-
* Item 3
213-
214-
2. **Numbered lists:** To create an ordered list, start each item with a number followed by a period and a space. Ensure that there is a blank line between the items and before and after the list:
215-
216-
.. code-block:: rst
217-
218-
1. Item 1
219-
220-
2. Item 2
221-
222-
3. Item 3
223-
224-
3. **Nested lists:** For nested unnumbered lists, indent each sub-item level using four spaces. Use the same asterisk (`*`) syntax for all levels. Also, ensure that there's a blank line between the items and before and after the list:
225-
226-
.. code-block:: rst
227-
228-
* Item 1
229-
* Sub-item 1
230-
* Sub-item 2
231-
232-
* Item 2
233-
* Sub-item 1
234-
* Sub-item 2
235-
236-
Code snippets
237-
~~~~~~~~~~~~~
238-
239-
Use the ``.. code-block::`` directive to display multi-line code snippets. Specify the file format or programming language after the directive to turn on proper syntax highlighting. For example:
240-
241-
.. code-block:: rst
242-
243-
.. code-block:: py
244-
245-
def hello_world():
246-
print("Hello, World!")
247-
248-
Inline code
249-
~~~~~~~~~~~
250-
251-
For short pieces of code within a sentence, use double **backticks (``)**. This helps distinguish the code from regular text. For example:
252-
253-
.. code-block:: rst
254-
255-
Use the ``print()`` function to display output.
256-
257-
Tables
258-
~~~~~~
259-
260-
You can choose to use either grid tables or simple tables. Each type has its own syntax and use cases:
261-
262-
1. **Grid tables:** Grid tables give you full control over the layout and structure of your table. You create them by manually drawing the cell grid using characters like **+**, **-**, and **|**.
263-
264-
Here’s an example of a grid table:
265-
266-
.. code-block:: rst
267-
268-
+-----------------+-----------------+
269-
| Header 1 | Header 2 |
270-
+=================+=================+
271-
| Row 1, Column 1 | Row 1, Column 2 |
272-
+-----------------+-----------------+
273-
| Row 2, Column 1 | Row 2, Column 2 |
274-
+-----------------+-----------------+
275-
276-
2. **Simple tables:** Simple tables are easier to create but come with some limitations. They require at least two rows, and the cells in the first column cannot span multiple lines.
277-
278-
Here’s an example of a simple table:
279-
280-
.. code-block:: rst
281-
282-
=============== ===============
283-
Header 1 Header 2
284-
=============== ===============
285-
Row 1, Column 1 Row 1, Column 2
286-
Row 2, Column 1 Row 2, Column 2
287-
=============== ===============

0 commit comments

Comments
 (0)