contributing_to_the_documentation.rst 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  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. ``2.1`` or ``3.0``) if your changes only
  40. apply to that specific version of Godot.
  41. Though less convenient to edit than a wiki, this Git repository is where we
  42. write the documentation. Having direct access to the source files in a revision
  43. control system is a plus to ensure our documentation quality.
  44. Editing existing pages
  45. ~~~~~~~~~~~~~~~~~~~~~~
  46. To edit an existing page, locate its ``.rst`` source file and open it in your
  47. favorite text editor. You can then commit the changes, push them to your fork,
  48. and make a pull request. **Note that the pages in** ``classes/`` **should not be
  49. edited here.** They are automatically generated from Godot's `XML class
  50. reference <https://github.com/godotengine/godot/tree/master/doc/classes>`__.
  51. See :ref:`doc_updating_the_class_reference` for details.
  52. .. seealso:: To build the manual and test changes on your computer, see
  53. :ref:`doc_building_the_manual`.
  54. Editing pages online
  55. --------------------
  56. You can edit the documentation online by clicking the **Edit on GitHub** link in
  57. the top-right of every page.
  58. Doing so takes you to the GitHub text editor. You need to have a GitHub account
  59. and to log in to use it. Once logged in, you can propose change like so:
  60. 1. Click the **Edit on GitHub** button.
  61. 2. On the GitHub page you're taken to, click the pencil icon in the top-right
  62. corner near the **Raw**, **Blame**, and **Delete** buttons. It has the
  63. tooltip "Fork this project and edit the file".
  64. 3. Edit the text in the text editor.
  65. 4. At the bottom of the web page, summarize the changes you made and click the
  66. button **Propose file change**. Make sure to replace the placeholder "Update file.rst"
  67. by a short but clear one-line description, as this is the commit title.
  68. 5. On the following screens, click the **Create pull request** button until you
  69. see a message like *Username wants to merge 1 commit into godotengine:master
  70. from Username:patch-1*.
  71. Another contributor will review your changes and merge them into the docs if
  72. they're good. They may also make changes or ask you to do so before merging.
  73. Adding new pages
  74. ----------------
  75. Before adding a new page, please ensure that it fits in the documentation:
  76. 1. Look for `existing issues
  77. <https://github.com/godotengine/godot-docs/issues>`_ or open a new one to see
  78. if the page is necessary.
  79. 2. Ensure there isn't a page that already covers the topic.
  80. 3. Read our :ref:`doc_content_guidelines`.
  81. To add a new page, create a ``.rst`` file with a meaningful name in the section you
  82. want to add a file to, e.g. ``tutorials/3d/light_baking.rst``.
  83. You should then add your page to the relevant "toctree" (table of contents,
  84. e.g. ``tutorials/3d/index.rst``). Add your new filename to the list on a new
  85. line, using a relative path and no extension, e.g. here ``light_baking``.
  86. Titles
  87. ~~~~~~
  88. Always begin pages with their title and a Sphinx reference name:
  89. ::
  90. .. _doc_insert_your_title_here:
  91. Insert your title here
  92. ======================
  93. The reference ``_doc_insert_your_title_here`` and the title should match.
  94. The reference allows linking to this page using the ``:ref:`` format, e.g.
  95. ``:ref:`doc_insert_your_title_here``` would link to the above example page (note
  96. the lack of leading underscore in the reference).
  97. Write your titles like plain sentences, without capitalizing each word:
  98. - **Good:** Understanding signals in Godot
  99. - **Bad:** Understanding Signals In Godot
  100. Only propers nouns, projects, people, and node class names should have their
  101. first letter capitalized.
  102. Sphinx and reStructuredText syntax
  103. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  104. Check Sphinx's `reST Primer <https://www.sphinx-doc.org/en/stable/rest.html>`__
  105. and the `official reference <https://docutils.sourceforge.net/rst.html>`__ for
  106. details on the syntax.
  107. Sphinx uses specific reST comments to do specific operations, like defining the
  108. table of contents (``.. toctree::``) or cross-referencing pages. Check the
  109. `official Sphinx documentation
  110. <https://www.sphinx-doc.org/en/stable/index.html>`__ for more details. To learn
  111. how to use Sphinx directives like ``.. note::`` or ``.. seealso::``, check out
  112. the `Sphinx directives documentation
  113. <https://www.sphinx-doc.org/en/master/usage/restructuredtext/directives.html>`__.
  114. Adding images and attachments
  115. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  116. To add images, please put them in an ``img/`` folder next to the ``.rst`` file with
  117. a meaningful name and include them in your page with:
  118. .. code:: rst
  119. .. image:: img/image_name.webp
  120. Alternatively, you can use the `figure` directive, which gives the image a contrasting
  121. border and allows centering it on the page.
  122. .. code:: rst
  123. .. figure:: img/image_name.webp
  124. :align: center
  125. You can also include attachments as support material for a tutorial, by placing them
  126. into a ``files/`` folder next to the ``.rst`` file, and using this inline markup:
  127. .. code:: rst
  128. :download:`file_name.zip <files/file_name.zip>`
  129. Consider using the `godot-docs-project-starters <https://github.com/godotengine/godot-docs-project-starters>`
  130. repository for hosting support materials, such as project templates and asset packs.
  131. You can use a direct link to the generated archive from that repository with the regular
  132. link markup:
  133. .. code:: rst
  134. `file_name.zip <https://github.com/godotengine/godot-docs-project-starters/releases/download/latest-4.x/file_name.zip>`_
  135. License
  136. -------
  137. This documentation and every page it contains is published under the terms of
  138. the `Creative Commons Attribution 3.0 license (CC BY 3.0)
  139. <https://creativecommons.org/licenses/by/3.0/>`_, with attribution to "Juan
  140. Linietsky, Ariel Manzur and the Godot community".
  141. By contributing to the documentation on the GitHub repository, you agree that
  142. your changes are distributed under this license.