SphinxQuickstartTemplate.rst 5.0 KB

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