Up to date
This page is up to date for Godot 4.3.
If you still find outdated information, please open an issue.
參與貢獻說明文件
本指南介紹的是如何向 Godot 的文件做出貢獻,無論是編寫頁面還是審核頁面。
也參考
如果你想要將頁面或類參考從英語翻譯為其他語言,請閱讀 本地化編輯器與說明文件。
入門
建立與編輯說明文件頁面通常是在 godot-docs GitHub 儲存庫 中完成的。HTML (或 PDF 與 EPUB) 說明文件是由該儲存庫中的 .rst 檔 (reStructuredText 標記語言) 產生的。使用 PR (Pull Request) 修改這些頁面並合併後就會重建線上說明文件。
也參考
有關詳細的 Git 使用方法與 PR 工作流程,請參考 Pull Request 工作流程 一頁。該頁面中大部分關於 godotengine/godot 儲存庫的說明也適用於這個說明文件的儲存庫。
警告
類參考的原始檔案位於 Godot 引擎倉庫 <https://github.com/godotengine/godot>`_中。我們會用它來生成本文件的 :ref:`Godot API <toc-class-ref> 章節。如果你想要更新類、方法、屬性等的描述資訊,請參閱 參與貢獻類別參照文件。
什麼是Godot文檔
Godot 文件旨在作為 Godot 遊戲引擎的完備參考手冊。除了“入門”章節的兩個遊戲製作教學之外,不包含漸進式教學。
我們致力於使用簡單通順的語言編寫實事求是的內容。投稿前請閱讀:
說明文件撰寫方針。為了讓寫出的內容讓所有人都能夠理解,你可以在這裡找到相關的規定和建議。
內容規範。對我們在編寫文件時所遵循的原則進行了解釋,也解釋了我們接受哪些形式的內容。
參與貢獻程式碼
Pull requests should use the master branch by default. Only make pull
requests against other branches (e.g. 3.6 or 4.2) if your changes only
apply to that specific version of Godot. After a pull request is merged into
master, it will usually be cherry-picked into the current stable branch by
documentation maintainers.
雖然編輯器來不如百科方便,但是我們就是在這個 Git 倉庫中編寫文件的。可以在版本控制系統中直接存取原始檔案,對於保證我們文件的品質是有利的。
翻譯現有頁面
要編輯已有頁面,請先定位其 .rst 原始檔案並在你喜歡的文字編輯器中打開。然後你就可以將修改提交、推送到你的 Fork 中,然後建立拉取請求。注意,請勿在此編輯 classes/ **中的頁面。**它們是根據 Godot 的 XML 類參考 <https://github.com/godotengine/godot/tree/master/doc/classes>`__自動生成的。詳情請參閱 :ref:`doc_updating_the_class_reference。
也參考
要在你的電腦上建構手冊並測試修改,請參閱 建置 Mono 執行環境。
編輯動畫
點擊每一頁右上角的 Edit on GitHub 連結即可線上編輯該文件。
這樣你就會跳轉到 GitHub 文字編輯器,要擁有 GitHub 帳戶並登錄才能夠使用。登錄後,可以這樣提出修改方案:
點擊 Edit on GitHub 按鈕。
On the GitHub page you're taken to, make sure the current branch is "master". Click the pencil icon in the top-right corner near the Raw, Blame, and Delete buttons. It has the tooltip "Fork this project and edit the file".
在編輯器中執行腳本。
Click "Commit changes...", summarize the changes you made and make sure to replace the placeholder "Update file.rst" by a short but clear one-line description, as this is the commit title. Click the button Propose changes.
在下一個畫面中,點擊「Create pull request」按鈕,之後會看到類似 Username wants to merge 1 commit into godotengine:master from Username:patch-6 。
備註
If there are more commits than your own in the pull request it is likely that your branch was created using the wrong origin, due to "master" not being the current branch in step 2. You will need to rebase your branch to "master" or create a new branch.
接著會有審閱者確認你的更改,如果這些改動沒問題的話就會被合併回說明文件內。在修改被合併前,也有可能會被要求作出其他修改。
新增新語言
在新增新頁面之前,請確保它適合現有文件:
搜索`已有 Issue <https://github.com/godotengine/godot-docs/issues>`或者提交新 Issue,確認該頁面是必須的。
確認目前不存在涉及該話題的頁面。
閱讀我們的 程式碼樣式方針。
要新增一個新頁面,請在想要的章節下建立一個 .rst 檔並起一個有意義的名字,例如 tutorials/3d/light_baking.rst。
你應該將你的頁面加入相關的“toctree”(目錄,例如 tutorials/3d/index.rst)。請將你的新檔案名加入目錄列表中,使用相對路徑,不要帶副檔名,例如 light_baking。
標題
頁面應以頁面標題與 Sphinx 參照名稱開頭:
.. _doc_insert_your_title_here:
Insert your title here
======================
引用 _doc_insert_your_title_here 應該和標題相配對。
可以使用 :ref: 格式來以參照名稱連結到該頁面,如 :ref:`doc_insert_your_title_here` 會連結到上述範例頁面 (請注意參照中沒有最前面的底線)。
請以普通句子的形式編寫標題,不要所有單詞都大寫:
Only proper nouns, projects, people, and node class names should have their first letter capitalized.
Sphinx 與 reStructuredText 語法
語法詳情請查看 Sphinx 的 reST Primer 及其`官方參考手冊 <http://docutils.sourceforge.net/rst.html>`__。
Sphinx 會利用特定的 reST 注釋來執行特定的操作,比如定義目錄(.. toctree::)或者進行頁面之間的交叉引用。詳情請查看 Sphinx 官方文件。要學習如何使用 .. note::、.. seealso:: 等 Sphinx 指令,請查看 Sphinx 指令文件。
新增更多節點
要新增圖片,請將它們放入 .rst 旁的 img/ 目錄中,起一個有意義的名字,然後在頁面中加入:
.. image:: img/image_name.webp
或者,你可以使用 figure 指令,該指令使圖像具有對比邊框並允許將其集中在頁面上。
.. figure:: img/image_name.webp
:align: center
新增附件的操作也與之類似,比如新增作為教學支援材料的素材,就可以先將它們放入 .rst 檔旁的 files/ 資料夾,然後使用這樣的行內標記:
:download:`file_name.zip <files/file_name.zip>`
考慮使用 godot-docs-project-starters <https://github.com/godotengine/godot-docs-project-starters> 來作為用於託管支援材料的儲存庫,例如專案範本和素材包。你可以使用常規連結標記使用直接連結到該倉庫中生成的存檔:
`file_name.zip <https://github.com/godotengine/godot-docs-project-starters/releases/download/latest-4.x/file_name.zip>`_
授權條款
這份文件以及其包含的所有頁面都是以創用 CC—姓名標示 (CC-BY 3.0) 發表,作者請標示「Juan Linietsky, Ariel Manzur and the Godot community」。
一旦於該 GitHub 儲存庫中參與貢獻說明文件,你便同意以該授權條款發行你所做出的修改。