blob: b0002bacb96fcd598fde6a93b69f10a84a76bc8f [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
Sean Silvac5351a02012-12-13 20:14:25 +0000110For a shell session, use a ``console`` code block (some existing docs use
111``bash``):
Sean Silva5d499c22012-10-12 00:53:48 +0000112
Dmitri Gribenko8ba48802012-12-12 20:07:18 +0000113.. code-block:: console
Sean Silva5d499c22012-10-12 00:53:48 +0000114
115 $ echo "Goodbye cruel world!"
116 $ rm -rf /
117
Sean Silvac5351a02012-12-13 20:14:25 +0000118If you need to show LLVM IR use the ``llvm`` code block.
Sean Silva5d499c22012-10-12 00:53:48 +0000119
Sean Silvac5351a02012-12-13 20:14:25 +0000120.. code-block:: llvm
121
122 define i32 @test1() {
123 entry:
124 ret i32 0
125 }
126
127Some other common code blocks you might need are ``c``, ``objc``, ``make``,
128and ``cmake``. If you need something beyond that, you can look at the `full
129list`_ of supported code blocks.
130
131.. _`full list`: http://pygments.org/docs/lexers/
132
133However, don't waste time fiddling with syntax highlighting when you could
134be adding meaningful content. When in doubt, show preformatted text
135without any syntax highlighting like this:
Sean Silvab63ae852012-12-05 04:07:33 +0000136
137::
138
139 .
140 +:.
141 ..:: ::
142 .++:+:: ::+:.:.
143 .:+ :
144 ::.::..:: .+.
145 ..:+ :: :
146 ......+:. ..
147 :++. .. :
148 .+:::+:: :
149 .. . .+ ::
150 +.: .::+.
151 ...+. .: .
152 .++:..
153 ...
154
Sean Silva5d499c22012-10-12 00:53:48 +0000155Hopefully you won't need to be this deep
156""""""""""""""""""""""""""""""""""""""""
157
158If you need to do fancier things than what has been shown in this document,
159you can mail the list or check Sphinx's `reStructuredText Primer`_.
160
161.. _`reStructuredText Primer`: http://sphinx.pocoo.org/rest.html