1*9880d681SAndroid Build Coastguard Worker========================== 2*9880d681SAndroid Build Coastguard WorkerSphinx Quickstart Template 3*9880d681SAndroid Build Coastguard Worker========================== 4*9880d681SAndroid Build Coastguard Worker 5*9880d681SAndroid Build Coastguard WorkerIntroduction and Quickstart 6*9880d681SAndroid Build Coastguard Worker=========================== 7*9880d681SAndroid Build Coastguard Worker 8*9880d681SAndroid Build Coastguard WorkerThis document is meant to get you writing documentation as fast as possible 9*9880d681SAndroid Build Coastguard Workereven if you have no previous experience with Sphinx. The goal is to take 10*9880d681SAndroid Build Coastguard Workersomeone in the state of "I want to write documentation and get it added to 11*9880d681SAndroid Build Coastguard WorkerLLVM's docs" and turn that into useful documentation mailed to llvm-commits 12*9880d681SAndroid Build Coastguard Workerwith as little nonsense as possible. 13*9880d681SAndroid Build Coastguard Worker 14*9880d681SAndroid Build Coastguard WorkerYou can find this document in ``docs/SphinxQuickstartTemplate.rst``. You 15*9880d681SAndroid Build Coastguard Workershould copy it, open the new file in your text editor, write your docs, and 16*9880d681SAndroid Build Coastguard Workerthen send the new document to llvm-commits for review. 17*9880d681SAndroid Build Coastguard Worker 18*9880d681SAndroid Build Coastguard WorkerFocus on *content*. It is easy to fix the Sphinx (reStructuredText) syntax 19*9880d681SAndroid Build Coastguard Workerlater if necessary, although reStructuredText tries to imitate common 20*9880d681SAndroid Build Coastguard Workerplain-text conventions so it should be quite natural. A basic knowledge of 21*9880d681SAndroid Build Coastguard WorkerreStructuredText syntax is useful when writing the document, so the last 22*9880d681SAndroid Build Coastguard Worker~half of this document (starting with `Example Section`_) gives examples 23*9880d681SAndroid Build Coastguard Workerwhich should cover 99% of use cases. 24*9880d681SAndroid Build Coastguard Worker 25*9880d681SAndroid Build Coastguard WorkerLet me say that again: focus on *content*. But if you really need to verify 26*9880d681SAndroid Build Coastguard WorkerSphinx's output, see ``docs/README.txt`` for information. 27*9880d681SAndroid Build Coastguard Worker 28*9880d681SAndroid Build Coastguard WorkerOnce you have finished with the content, please send the ``.rst`` file to 29*9880d681SAndroid Build Coastguard Workerllvm-commits for review. 30*9880d681SAndroid Build Coastguard Worker 31*9880d681SAndroid Build Coastguard WorkerGuidelines 32*9880d681SAndroid Build Coastguard Worker========== 33*9880d681SAndroid Build Coastguard Worker 34*9880d681SAndroid Build Coastguard WorkerTry to answer the following questions in your first section: 35*9880d681SAndroid Build Coastguard Worker 36*9880d681SAndroid Build Coastguard Worker#. Why would I want to read this document? 37*9880d681SAndroid Build Coastguard Worker 38*9880d681SAndroid Build Coastguard Worker#. What should I know to be able to follow along with this document? 39*9880d681SAndroid Build Coastguard Worker 40*9880d681SAndroid Build Coastguard Worker#. What will I have learned by the end of this document? 41*9880d681SAndroid Build Coastguard Worker 42*9880d681SAndroid Build Coastguard WorkerCommon names for the first section are ``Introduction``, ``Overview``, or 43*9880d681SAndroid Build Coastguard Worker``Background``. 44*9880d681SAndroid Build Coastguard Worker 45*9880d681SAndroid Build Coastguard WorkerIf possible, make your document a "how to". Give it a name ``HowTo*.rst`` 46*9880d681SAndroid Build Coastguard Workerlike the other "how to" documents. This format is usually the easiest 47*9880d681SAndroid Build Coastguard Workerfor another person to understand and also the most useful. 48*9880d681SAndroid Build Coastguard Worker 49*9880d681SAndroid Build Coastguard WorkerYou generally should not be writing documentation other than a "how to" 50*9880d681SAndroid Build Coastguard Workerunless there is already a "how to" about your topic. The reason for this 51*9880d681SAndroid Build Coastguard Workeris that without a "how to" document to read first, it is difficult for a 52*9880d681SAndroid Build Coastguard Workerperson to understand a more advanced document. 53*9880d681SAndroid Build Coastguard Worker 54*9880d681SAndroid Build Coastguard WorkerFocus on content (yes, I had to say it again). 55*9880d681SAndroid Build Coastguard Worker 56*9880d681SAndroid Build Coastguard WorkerThe rest of this document shows example reStructuredText markup constructs 57*9880d681SAndroid Build Coastguard Workerthat are meant to be read by you in your text editor after you have copied 58*9880d681SAndroid Build Coastguard Workerthis file into a new file for the documentation you are about to write. 59*9880d681SAndroid Build Coastguard Worker 60*9880d681SAndroid Build Coastguard WorkerExample Section 61*9880d681SAndroid Build Coastguard Worker=============== 62*9880d681SAndroid Build Coastguard Worker 63*9880d681SAndroid Build Coastguard WorkerYour text can be *emphasized*, **bold**, or ``monospace``. 64*9880d681SAndroid Build Coastguard Worker 65*9880d681SAndroid Build Coastguard WorkerUse blank lines to separate paragraphs. 66*9880d681SAndroid Build Coastguard Worker 67*9880d681SAndroid Build Coastguard WorkerHeadings (like ``Example Section`` just above) give your document its 68*9880d681SAndroid Build Coastguard Workerstructure. Use the same kind of adornments (e.g. ``======`` vs. ``------``) 69*9880d681SAndroid Build Coastguard Workeras are used in this document. The adornment must be the same length as the 70*9880d681SAndroid Build Coastguard Workertext above it. For Vim users, variations of ``yypVr=`` might be handy. 71*9880d681SAndroid Build Coastguard Worker 72*9880d681SAndroid Build Coastguard WorkerExample Subsection 73*9880d681SAndroid Build Coastguard Worker------------------ 74*9880d681SAndroid Build Coastguard Worker 75*9880d681SAndroid Build Coastguard WorkerMake a link `like this <http://llvm.org/>`_. There is also a more 76*9880d681SAndroid Build Coastguard Workersophisticated syntax which `can be more readable`_ for longer links since 77*9880d681SAndroid Build Coastguard Workerit disrupts the flow less. You can put the ``.. _`link text`: <URL>`` block 78*9880d681SAndroid Build Coastguard Workerpretty much anywhere later in the document. 79*9880d681SAndroid Build Coastguard Worker 80*9880d681SAndroid Build Coastguard Worker.. _`can be more readable`: http://en.wikipedia.org/wiki/LLVM 81*9880d681SAndroid Build Coastguard Worker 82*9880d681SAndroid Build Coastguard WorkerLists can be made like this: 83*9880d681SAndroid Build Coastguard Worker 84*9880d681SAndroid Build Coastguard Worker#. A list starting with ``#.`` will be automatically numbered. 85*9880d681SAndroid Build Coastguard Worker 86*9880d681SAndroid Build Coastguard Worker#. This is a second list element. 87*9880d681SAndroid Build Coastguard Worker 88*9880d681SAndroid Build Coastguard Worker #. Use indentation to create nested lists. 89*9880d681SAndroid Build Coastguard Worker 90*9880d681SAndroid Build Coastguard WorkerYou can also use unordered lists. 91*9880d681SAndroid Build Coastguard Worker 92*9880d681SAndroid Build Coastguard Worker* Stuff. 93*9880d681SAndroid Build Coastguard Worker 94*9880d681SAndroid Build Coastguard Worker + Deeper stuff. 95*9880d681SAndroid Build Coastguard Worker 96*9880d681SAndroid Build Coastguard Worker* More stuff. 97*9880d681SAndroid Build Coastguard Worker 98*9880d681SAndroid Build Coastguard WorkerExample Subsubsection 99*9880d681SAndroid Build Coastguard Worker^^^^^^^^^^^^^^^^^^^^^ 100*9880d681SAndroid Build Coastguard Worker 101*9880d681SAndroid Build Coastguard WorkerYou can make blocks of code like this: 102*9880d681SAndroid Build Coastguard Worker 103*9880d681SAndroid Build Coastguard Worker.. code-block:: c++ 104*9880d681SAndroid Build Coastguard Worker 105*9880d681SAndroid Build Coastguard Worker int main() { 106*9880d681SAndroid Build Coastguard Worker return 0; 107*9880d681SAndroid Build Coastguard Worker } 108*9880d681SAndroid Build Coastguard Worker 109*9880d681SAndroid Build Coastguard WorkerFor a shell session, use a ``console`` code block (some existing docs use 110*9880d681SAndroid Build Coastguard Worker``bash``): 111*9880d681SAndroid Build Coastguard Worker 112*9880d681SAndroid Build Coastguard Worker.. code-block:: console 113*9880d681SAndroid Build Coastguard Worker 114*9880d681SAndroid Build Coastguard Worker $ echo "Goodbye cruel world!" 115*9880d681SAndroid Build Coastguard Worker $ rm -rf / 116*9880d681SAndroid Build Coastguard Worker 117*9880d681SAndroid Build Coastguard WorkerIf you need to show LLVM IR use the ``llvm`` code block. 118*9880d681SAndroid Build Coastguard Worker 119*9880d681SAndroid Build Coastguard Worker.. code-block:: llvm 120*9880d681SAndroid Build Coastguard Worker 121*9880d681SAndroid Build Coastguard Worker define i32 @test1() { 122*9880d681SAndroid Build Coastguard Worker entry: 123*9880d681SAndroid Build Coastguard Worker ret i32 0 124*9880d681SAndroid Build Coastguard Worker } 125*9880d681SAndroid Build Coastguard Worker 126*9880d681SAndroid Build Coastguard WorkerSome other common code blocks you might need are ``c``, ``objc``, ``make``, 127*9880d681SAndroid Build Coastguard Workerand ``cmake``. If you need something beyond that, you can look at the `full 128*9880d681SAndroid Build Coastguard Workerlist`_ of supported code blocks. 129*9880d681SAndroid Build Coastguard Worker 130*9880d681SAndroid Build Coastguard Worker.. _`full list`: http://pygments.org/docs/lexers/ 131*9880d681SAndroid Build Coastguard Worker 132*9880d681SAndroid Build Coastguard WorkerHowever, don't waste time fiddling with syntax highlighting when you could 133*9880d681SAndroid Build Coastguard Workerbe adding meaningful content. When in doubt, show preformatted text 134*9880d681SAndroid Build Coastguard Workerwithout any syntax highlighting like this: 135*9880d681SAndroid Build Coastguard Worker 136*9880d681SAndroid Build Coastguard Worker:: 137*9880d681SAndroid Build Coastguard Worker 138*9880d681SAndroid Build Coastguard Worker . 139*9880d681SAndroid Build Coastguard Worker +:. 140*9880d681SAndroid Build Coastguard Worker ..:: :: 141*9880d681SAndroid Build Coastguard Worker .++:+:: ::+:.:. 142*9880d681SAndroid Build Coastguard Worker .:+ : 143*9880d681SAndroid Build Coastguard Worker ::.::..:: .+. 144*9880d681SAndroid Build Coastguard Worker ..:+ :: : 145*9880d681SAndroid Build Coastguard Worker ......+:. .. 146*9880d681SAndroid Build Coastguard Worker :++. .. : 147*9880d681SAndroid Build Coastguard Worker .+:::+:: : 148*9880d681SAndroid Build Coastguard Worker .. . .+ :: 149*9880d681SAndroid Build Coastguard Worker +.: .::+. 150*9880d681SAndroid Build Coastguard Worker ...+. .: . 151*9880d681SAndroid Build Coastguard Worker .++:.. 152*9880d681SAndroid Build Coastguard Worker ... 153*9880d681SAndroid Build Coastguard Worker 154*9880d681SAndroid Build Coastguard WorkerHopefully you won't need to be this deep 155*9880d681SAndroid Build Coastguard Worker"""""""""""""""""""""""""""""""""""""""" 156*9880d681SAndroid Build Coastguard Worker 157*9880d681SAndroid Build Coastguard WorkerIf you need to do fancier things than what has been shown in this document, 158*9880d681SAndroid Build Coastguard Workeryou can mail the list or check Sphinx's `reStructuredText Primer`_. 159*9880d681SAndroid Build Coastguard Worker 160*9880d681SAndroid Build Coastguard Worker.. _`reStructuredText Primer`: http://sphinx.pocoo.org/rest.html 161