blob: 75d916368e33e0eba9517e2bb7dba50e8e0f3a4a [file] [log] [blame]
Sean Silva5d499c22012-10-12 00:53:48 +00001==========================
2Sphinx Quickstart Template
3==========================
4
5.. sectionauthor:: Sean Silva <silvas@purdue.edu>
6
7Introduction and Quickstart
8===========================
9
10This document is meant to get you writing documentation as fast as possible
11even if you have no previous experience with Sphinx. The goal is to take
12someone in the state of "I want to write documentation and get it added to
13LLVM's docs" and turn that into useful documentation mailed to llvm-commits
14with as little nonsense as possible.
15
16You can find this document in ``docs/SphinxQuickstartTemplate.rst``. You
17should copy it, open the new file in your text editor, write your docs, and
18then send the new document to llvm-commits for review.
19
20Focus on *content*. It is easy to fix the Sphinx (reStructuredText) syntax
21later if necessary, although reStructuredText tries to imitate common
22plain-text conventions so it should be quite natural. A basic knowledge of
23reStructuredText syntax is useful when writing the document, so the last
24~half of this document (starting with `Example Section`_) gives examples
25which should cover 99% of use cases.
26
27Let me say that again: focus on *content*.
28
29Once you have finished with the content, please send the ``.rst`` file to
30llvm-commits for review.
31
32Guidelines
33==========
34
35Try to answer the following questions in your first section:
36
37#. Why would I want to read this document?
38
39#. What should I know to be able to follow along with this document?
40
41#. What will I have learned by the end of this document?
42
43Common names for the first section are ``Introduction``, ``Overview``, or
44``Background``.
45
46If possible, make your document a "how to". Give it a name ``HowTo*.rst``
47like the other "how to" documents. This format is usually the easiest
48for another person to understand and also the most useful.
49
50You generally should not be writing documentation other than a "how to"
51unless there is already a "how to" about your topic. The reason for this
52is that without a "how to" document to read first, it is difficult for a
53person to understand a more advanced document.
54
55Focus on content (yes, I had to say it again).
56
57The rest of this document shows example reStructuredText markup constructs
58that are meant to be read by you in your text editor after you have copied
59this file into a new file for the documentation you are about to write.
60
61Example Section
62===============
63
64Your text can be *emphasized*, **bold**, or ``monospace``.
65
66Use blank lines to separate paragraphs.
67
68Headings (like ``Example Section`` just above) give your document
69structure. Use the same kind of adornments (e.g. ``======`` vs. ``------``)
70as are used in this document. The adornment must be the same length as the
71text above it. For Vim users, variations of ``yypVr=`` might be handy.
72
73Example Subsection
74------------------
75
76Make a link `like this <http://llvm.org/>`_. There is also a more
77sophisticated syntax which `can be more readable`_ for longer links since
78it disrupts the flow less. You can put the ``.. _`link text`: <URL>`` block
79pretty much anywhere later in the document.
80
81.. _`can be more readable`: http://en.wikipedia.org/wiki/LLVM
82
83Lists can be made like this:
84
85#. A list starting with ``#.`` will be automatically numbered.
86
87#. This is a second list element.
88
89 #. They nest too.
90
91You can also use unordered lists.
92
93* Stuff.
94
95 + Deeper stuff.
96
97* More stuff.
98
99Example Subsubsection
100^^^^^^^^^^^^^^^^^^^^^
101
102You can make blocks of code like this:
103
104.. code-block:: c++
105
106 int main() {
107 return 0
108 }
109
110For a shell session, use a ``bash`` code block:
111
112.. code-block:: bash
113
114 $ echo "Goodbye cruel world!"
115 $ rm -rf /
116
117If you need to show LLVM IR use the ``llvm`` code block.
118
119Hopefully you won't need to be this deep
120""""""""""""""""""""""""""""""""""""""""
121
122If you need to do fancier things than what has been shown in this document,
123you can mail the list or check Sphinx's `reStructuredText Primer`_.
124
125.. _`reStructuredText Primer`: http://sphinx.pocoo.org/rest.html