contributing_to_the_documentation.rst 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216
  1. .. _doc_contributing_to_the_documentation:
  2. Contributing to the documentation
  3. =================================
  4. This guide explains how to contribute to Godot's documentation, be it by
  5. writing or reviewing pages.
  6. .. seealso::
  7. If you want to translate pages or the class reference from English to other
  8. languages, read :ref:`doc_editor_and_docs_localization`.
  9. Getting started
  10. ---------------
  11. To modify or create pages in the reference manual, you need to edit ``.rst``
  12. files in the `godot-docs GitHub repository
  13. <https://github.com/godotengine/godot-docs>`_. Modifying those pages in a pull
  14. request triggers a rebuild of the online documentation upon merging.
  15. .. seealso:: For details on Git usage and the pull request workflow, please
  16. refer to the :ref:`doc_pr_workflow` page. Most of what it describes
  17. regarding the main godotengine/godot repository is also valid for
  18. the docs repository.
  19. .. warning:: The class reference's source files are in the `Godot engine
  20. repository <https://github.com/godotengine/godot>`_. We generate
  21. the :ref:`Class Reference <doc_class_reference>` section of this documentation
  22. from them. If you want to update the description of a class, its
  23. methods, or properties, read
  24. :ref:`doc_updating_the_class_reference`.
  25. What is the Godot documentation
  26. -------------------------------
  27. The Godot documentation is intended as a comprehensive reference manual for the
  28. Godot game engine. It is not meant to contain step-by-step tutorials, except for
  29. two game creation tutorials in the Getting Started section.
  30. We strive to write factual content in an accessible and well-written language. To
  31. contribute, you should also read:
  32. 1. :ref:`doc_docs_writing_guidelines`. There, you will find rules and
  33. recommendations to write in a way that everyone understands.
  34. 2. :ref:`doc_content_guidelines`. They explain the principles we follow to write the
  35. documentation and the kind of content we accept.
  36. Contributing changes
  37. --------------------
  38. **Pull requests should use the** ``master`` **branch by default.** Only make pull
  39. requests against other branches (e.g. ``3.6`` or ``4.2``) if your changes only
  40. apply to that specific version of Godot. After a pull request is merged into
  41. ``master``, it will usually be cherry-picked into the current stable branch by
  42. documentation maintainers.
  43. Though less convenient to edit than a wiki, this Git repository is where we
  44. write the documentation. Having direct access to the source files in a revision
  45. control system is a plus to ensure our documentation quality.
  46. Editing existing pages
  47. ~~~~~~~~~~~~~~~~~~~~~~
  48. To edit an existing page, locate its ``.rst`` source file and open it in your
  49. favorite text editor. You can then commit the changes, push them to your fork,
  50. and make a pull request. **Note that the pages in** ``classes/`` **should not be
  51. edited here.** They are automatically generated from Godot's `XML class
  52. reference <https://github.com/godotengine/godot/tree/master/doc/classes>`__.
  53. See :ref:`doc_updating_the_class_reference` for details.
  54. .. seealso:: To build the manual and test changes on your computer, see
  55. :ref:`doc_building_the_manual`.
  56. Editing pages online
  57. --------------------
  58. You can edit the documentation online by clicking the **Edit on GitHub** link in
  59. the top-right of every page.
  60. Doing so takes you to the GitHub text editor. You need to have a GitHub account
  61. and to log in to use it. Once logged in, you can propose change like so:
  62. 1. Click the **Edit on GitHub** button.
  63. 2. On the GitHub page you're taken to, make sure the current branch is "master".
  64. Click the pencil icon in the top-right corner
  65. near the **Raw**, **Blame**, and **Delete** buttons.
  66. It has the tooltip "Fork this project and edit the file".
  67. 3. Edit the text in the text editor.
  68. 4. Click "Commit changes...", summarize the changes you made
  69. and make sure to replace the placeholder "Update file.rst" by a short,
  70. but clear one-line description, as this is the commit title.
  71. Click the button **Propose changes**.
  72. 5. On the following screens, click the **Create pull request** button until you
  73. see a message like *Username wants to merge 1 commit into godotengine:master
  74. from Username:patch-1*.
  75. .. note::
  76. If there are more commits than your own in the pull request
  77. it is likely that your branch was created using the wrong origin,
  78. due to "master" not being the current branch in step 2.
  79. You will need to rebase your branch to "master" or create a new branch.
  80. Another contributor will review your changes and merge them into the docs if
  81. they're good. They may also make changes or ask you to do so before merging.
  82. Adding new pages
  83. ----------------
  84. Before adding a new page, please ensure that it fits in the documentation:
  85. 1. Look for `existing issues
  86. <https://github.com/godotengine/godot-docs/issues>`_ or open a new one to see
  87. if the page is necessary.
  88. 2. Ensure there isn't a page that already covers the topic.
  89. 3. Read our :ref:`doc_content_guidelines`.
  90. To add a new page, create a ``.rst`` file with a meaningful name in the section you
  91. want to add a file to, e.g. ``tutorials/3d/light_baking.rst``.
  92. You should then add your page to the relevant "toctree" (table of contents,
  93. e.g. ``tutorials/3d/index.rst``). Add your new filename to the list on a new
  94. line, using a relative path and no extension, e.g. here ``light_baking``.
  95. Titles
  96. ~~~~~~
  97. Always begin pages with their title and a Sphinx reference name:
  98. ::
  99. .. _doc_insert_your_title_here:
  100. Insert your title here
  101. ======================
  102. The reference ``_doc_insert_your_title_here`` and the title should match.
  103. The reference allows linking to this page using the ``:ref:`` format, e.g.
  104. ``:ref:`doc_insert_your_title_here``` would link to the above example page (note
  105. the lack of leading underscore in the reference).
  106. Write your titles like plain sentences, without capitalizing each word:
  107. - **Good:** Understanding signals in Godot
  108. - **Bad:** Understanding Signals In Godot
  109. Only proper nouns, projects, people, and node class names should have their
  110. first letter capitalized.
  111. Sphinx and reStructuredText syntax
  112. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  113. Check Sphinx's `reST Primer <https://www.sphinx-doc.org/en/stable/rest.html>`__
  114. and the `official reference <https://docutils.sourceforge.net/rst.html>`__ for
  115. details on the syntax.
  116. Sphinx uses specific reST comments to do specific operations, like defining the
  117. table of contents (``.. toctree::``) or cross-referencing pages. Check the
  118. `official Sphinx documentation
  119. <https://www.sphinx-doc.org/en/stable/index.html>`__ for more details. To learn
  120. how to use Sphinx directives like ``.. note::`` or ``.. seealso::``, check out
  121. the `Sphinx directives documentation
  122. <https://www.sphinx-doc.org/en/master/usage/restructuredtext/directives.html>`__.
  123. Adding images and attachments
  124. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  125. To add images, please put them in an ``img/`` folder next to the ``.rst`` file with
  126. a meaningful name and include them in your page with:
  127. .. code:: rst
  128. .. image:: img/image_name.webp
  129. Alternatively, you can use the `figure` directive, which gives the image a contrasting
  130. border and allows centering it on the page.
  131. .. code:: rst
  132. .. figure:: img/image_name.webp
  133. :align: center
  134. You can also include attachments as support material for a tutorial, by placing them
  135. into a ``files/`` folder next to the ``.rst`` file, and using this inline markup:
  136. .. code:: rst
  137. :download:`file_name.zip <files/file_name.zip>`
  138. Consider using the `godot-docs-project-starters <https://github.com/godotengine/godot-docs-project-starters>`
  139. repository for hosting support materials, such as project templates and asset packs.
  140. You can use a direct link to the generated archive from that repository with the regular
  141. link markup:
  142. .. code:: rst
  143. `file_name.zip <https://github.com/godotengine/godot-docs-project-starters/releases/download/latest-4.x/file_name.zip>`_
  144. License
  145. -------
  146. This documentation and every page it contains is published under the terms of
  147. the `Creative Commons Attribution 3.0 license (CC BY 3.0)
  148. <https://creativecommons.org/licenses/by/3.0/>`_, with attribution to "Juan
  149. Linietsky, Ariel Manzur and the Godot community".
  150. By contributing to the documentation on the GitHub repository, you agree that
  151. your changes are distributed under this license.