Skip to content

Commit 2df650c

Browse files
author
Kenneth Reitz
committed
Merge pull request realpython#64 from dcrosta/styleguide-78chars
Styleguide: wrap at 78 chars
2 parents 4c68f91 + f48d848 commit 2df650c

File tree

1 file changed

+58
-26
lines changed

1 file changed

+58
-26
lines changed

docs/notes/styleguide.rst

Lines changed: 58 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,34 @@
44
The Guide Style Guide
55
=====================
66

7-
As with all documentation, having a consistent formating helps make the document more understandable. In order to make The Guide easier to digest, all contributions should fit within the rules of this style guide where approriate.
7+
As with all documentation, having a consistent formating helps make the
8+
document more understandable. In order to make The Guide easier to digest,
9+
all contributions should fit within the rules of this style guide where
10+
approriate.
811

9-
The Guide is written as :ref:`restructuredtext-ref`.
12+
The Guide is written as :ref:`restructuredtext-ref`.
1013

11-
.. note:: Parts of The Guide may not yet match this style guide. Feel free to update those parts to by in sync with The Guide Style Guide
14+
.. note:: Parts of The Guide may not yet match this style guide. Feel free
15+
to update those parts to by in sync with The Guide Style Guide
1216

13-
.. note:: On any page of the rendered HTML you can click "Show Source" to see how authors have styled the page.
17+
.. note:: On any page of the rendered HTML you can click "Show Source" to
18+
see how authors have styled the page.
1419

1520
Relevancy
1621
---------
1722

18-
Stride to keep any contributions relevant to the :ref:`purpose of The Guide <about-ref>`.
19-
20-
* Avoid including too much information on subjects that don't directly relate to Python development.
21-
* Prefer to link to other sources if the information is already out there. Be sure to describe what and why you are linking.
22-
* `Cite <http://sphinx.pocoo.org/rest.html?highlight=citations#citations>`_ references where needed.
23-
* If a subject isn't directly relevant to Python, but useful in conjuction with Python (ex: Git, Github, Databases), reference by linking to useful resouces and describe why it's useful to Python.
23+
Stride to keep any contributions relevant to the :ref:`purpose of The Guide
24+
<about-ref>`.
25+
26+
* Avoid including too much information on subjects that don't directly
27+
relate to Python development.
28+
* Prefer to link to other sources if the information is already out there.
29+
Be sure to describe what and why you are linking.
30+
* `Cite <http://sphinx.pocoo.org/rest.html?highlight=citations#citations>`_
31+
references where needed.
32+
* If a subject isn't directly relevant to Python, but useful in conjuction
33+
with Python (ex: Git, Github, Databases), reference by linking to useful
34+
resouces and describe why it's useful to Python.
2435
* When in doubt, ask.
2536

2637
Headings
@@ -49,11 +60,19 @@ Sub section headings::
4960

5061
Very Deep
5162
~~~~~~~~~
52-
63+
64+
Prose
65+
-----
66+
67+
Wrap text lines at 78 characters. Where necessary, lines may exceed 78
68+
characters, especially if wrapping would make the source text more difficult
69+
to read.
70+
71+
5372
Code Examples
5473
-------------
5574

56-
Wrap all code examples within 70 characters to avoid horizontal scrollbars.
75+
Wrap all code examples at 70 characters to avoid horizontal scrollbars.
5776

5877
Command line examples::
5978

@@ -65,17 +84,21 @@ Command line examples::
6584
Be sure to include the ``$`` prefix before each line.
6685

6786
Python interpreter examples::
68-
87+
6988
Label the example::
70-
89+
90+
.. code-block:: python
91+
7192
>>> import this
7293

7394
Python examples::
7495

7596
Descriptive title::
7697

98+
.. code-block:: python
99+
77100
def get_answer():
78-
return 42
101+
return 42
79102

80103
Externally Linking
81104
------------------
@@ -86,16 +109,20 @@ Externally Linking
86109

87110
.. _Sphinx: http://sphinx.pocoo.org
88111

89-
* Prefer to use descriptive labels with inline links instead of leaving bare links::
112+
* Prefer to use descriptive labels with inline links instead of leaving bare
113+
links::
90114

91115
Read the `Sphinx Tutorial <http://sphinx.pocoo.org/tutorial.html>`_
92116

93-
* Avoid using labels such as "click here", "this", etc. preferring decriptive labels (SEO worthy) instead.
117+
* Avoid using labels such as "click here", "this", etc. preferring
118+
decriptive labels (SEO worthy) instead.
94119

95120
Linking to Sections in The Guide
96121
--------------------------------
97122

98-
To cross-reference other parts of this documentation, use the `:ref: <http://sphinx.pocoo.org/markup/inline.html#cross-referencing-arbitrary-locations>`_ keyword and labels.
123+
To cross-reference other parts of this documentation, use the `:ref:
124+
<http://sphinx.pocoo.org/markup/inline.html#cross-referencing-arbitrary-locations>`_
125+
keyword and labels.
99126

100127
To make reference labels more clear and unique, always add a ``-ref`` suffix::
101128

@@ -107,26 +134,31 @@ To make reference labels more clear and unique, always add a ``-ref`` suffix::
107134
Notes and Warnings
108135
------------------
109136

110-
Make use of the appropriate `admonitions directives <http://sphinx.pocoo.org/rest.html#directives>`_ when making notes.
137+
Make use of the appropriate `admonitions directives
138+
<http://sphinx.pocoo.org/rest.html#directives>`_ when making notes.
111139

112140
Notes::
113-
114-
.. note::
141+
142+
.. note::
115143
The Hitchhiker’s Guide to the Galaxy has a few things to say
116144
on the subject of towels. A towel, it says, is about the most
117145
massively useful thing an interstellar hitch hiker can have.
118146

119147
Warnings::
120-
148+
121149
.. warning:: DON'T PANIC
122150

123151
TODOs
124152
-----
125153

126-
Please mark any incomplete areas of The Guide with a `todo directive <http://sphinx.pocoo.org/ext/todo.html?highlight=todo#directive-todo>`_. To avoid cluttering the :ref:`todo-list-ref`, use a single ``todo`` for stub documents or large incomplete sections.
154+
Please mark any incomplete areas of The Guide with a `todo directive
155+
<http://sphinx.pocoo.org/ext/todo.html?highlight=todo#directive-todo>`_. To
156+
avoid cluttering the :ref:`todo-list-ref`, use a single ``todo`` for stub
157+
documents or large incomplete sections.
127158

128159
::
129160

130-
.. todo::
131-
Learn the Ultimate Answer to the Ultimate Question
132-
of Life, The Universe, and Everything
161+
.. todo::
162+
Learn the Ultimate Answer to the Ultimate Question
163+
of Life, The Universe, and Everything
164+

0 commit comments

Comments
 (0)