|
| 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 |
0 commit comments