Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 3dbd567

Browse filesBrowse files
author
Kenneth Reitz
committed
Merge pull request realpython#60 from six8/styleguide
First pass at styleguide
2 parents 1df22ab + 909bd39 commit 3dbd567
Copy full SHA for 3dbd567

File tree

Expand file treeCollapse file tree

6 files changed

+153
-3
lines changed
Filter options
Expand file treeCollapse file tree

6 files changed

+153
-3
lines changed

‎TODO.rst

Copy file name to clipboard
-1Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
* Establish "use this" vs "alternatives are...." recommendations
2-
* Style Guide (for Guide)
32

43
.. todolist::

‎docs/contents.rst.inc

Copy file name to clipboardExpand all lines: docs/contents.rst.inc
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,4 +84,4 @@ Contibution notes and legal information are here (for those interested).
8484
:maxdepth: 2
8585

8686
notes/contribute
87-
notes/license
87+
notes/license

‎docs/intro/duction.rst

Copy file name to clipboardExpand all lines: docs/intro/duction.rst
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ Introduction
33

44
.. todo:: write a general blurb introducing the Python language
55

6+
.. _about-ref:
7+
68
About This Guide
79
----------------
810

‎docs/notes/contribute.rst

Copy file name to clipboardExpand all lines: docs/notes/contribute.rst
+6Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@ issue on GitHub_. To submit patches, please send a pull request on GitHub_.
88
Once your changes get merged back in, you'll automatically be added to the
99
`Contributors List <https://github.com/kennethreitz/python-guide/contributors>`_.
1010

11+
Style Guide
12+
-----------
13+
14+
For all contributions, please follow the :ref:`guide-style-guide`.
15+
16+
.. _todo-list-ref:
1117

1218
Todo List
1319
---------

‎docs/notes/styleguide.rst

Copy file name to clipboard
+132Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
.. _guide-style-guide:
2+
3+
=====================
4+
The Guide Style Guide
5+
=====================
6+
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.
8+
9+
The Guide is written as :ref:`restructuredtext-ref`.
10+
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
12+
13+
.. note:: On any page of the rendered HTML you can click "Show Source" to see how authors have styled the page.
14+
15+
Relevancy
16+
---------
17+
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.
24+
* When in doubt, ask.
25+
26+
Headings
27+
--------
28+
29+
Use the following styles for headings.
30+
31+
Chapter title::
32+
33+
#########
34+
Chapter 1
35+
#########
36+
37+
Page title::
38+
39+
===================
40+
Time is an Illusion
41+
===================
42+
43+
Section headings::
44+
45+
Lunchtime Doubly So
46+
-------------------
47+
48+
Sub section headings::
49+
50+
Very Deep
51+
~~~~~~~~~
52+
53+
Code Examples
54+
-------------
55+
56+
Wrap all code examples within 70 characters to avoid horizontal scrollbars.
57+
58+
Command line examples::
59+
60+
.. code-block:: console
61+
62+
$ run command --help
63+
$ ls ..
64+
65+
Be sure to include the ``$`` prefix before each line.
66+
67+
Python interpreter examples::
68+
69+
Label the example::
70+
71+
>>> import this
72+
73+
Python examples::
74+
75+
Descriptive title::
76+
77+
def get_answer():
78+
return 42
79+
80+
Externally Linking
81+
------------------
82+
83+
* Prefer labels for well known subjects (ex: proper nouns) when linking::
84+
85+
Sphinx_ is used to document Python.
86+
87+
.. _Sphinx: http://sphinx.pocoo.org
88+
89+
* Prefer to use descriptive labels with inline links instead of leaving bare links::
90+
91+
Read the `Sphinx Tutorial <http://sphinx.pocoo.org/tutorial.html>`_
92+
93+
* Avoid using labels such as "click here", "this", etc. preferring decriptive labels (SEO worthy) instead.
94+
95+
Linking to Sections in The Guide
96+
--------------------------------
97+
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.
99+
100+
To make reference labels more clear and unique, always add a ``-ref`` suffix::
101+
102+
.. _some-section-ref:
103+
104+
Some Section
105+
------------
106+
107+
Notes and Warnings
108+
------------------
109+
110+
Make use of the appropriate `admonitions directives <http://sphinx.pocoo.org/rest.html#directives>`_ when making notes.
111+
112+
Notes::
113+
114+
.. note::
115+
The Hitchhiker’s Guide to the Galaxy has a few things to say
116+
on the subject of towels. A towel, it says, is about the most
117+
massively useful thing an interstellar hitch hiker can have.
118+
119+
Warnings::
120+
121+
.. warning:: DON'T PANIC
122+
123+
TODOs
124+
-----
125+
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.
127+
128+
::
129+
130+
.. todo::
131+
Learn the Ultimate Answer to the Ultimate Question
132+
of Life, The Universe, and Everything

‎docs/writing/documentation.rst

Copy file name to clipboardExpand all lines: docs/writing/documentation.rst
+12-1Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,20 @@ Multi-line docstrings: ::
5959

6060
Sphinx
6161
------
62-
Sphinx (http://sphinx.pocoo.org) is a tool which converts documentation in the reStructured text markup language into a range of output formats including HTML, LaTeX (for printable PDF versions), manual pages and plain text.
62+
Sphinx_ is a tool which converts documentation in the :ref:`restructuredtext-ref` markup language into a range of output formats including HTML, LaTeX (for printable PDF versions), manual pages and plain text.
6363

64+
.. note:: This Guide is built with Sphinx_
6465

66+
.. _Sphinx: http://sphinx.pocoo.org
67+
68+
.. _restructuredtext-ref:
69+
70+
reStructuredText
71+
----------------
72+
73+
Most Python documentation is written with reStructuredText_. The `reStructuredText Primer <http://sphinx.pocoo.org/rest.html>`_ and the `reStructuredText Quick Reference <http://docutils.sourceforge.net/docs/user/rst/quickref.html>`_ should help you familiarize yourself with its syntax.
74+
75+
.. _reStructuredText: http://docutils.sourceforge.net/rst.html
6576

6677
Other Tools
6778
:::::::::::

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.