Class reference writing guidelines

    See also

    To learn to submit your changes to the Godot project using the Git version control system, see Contributing to the class reference.

    The reference for each class is contained in an XML file like the one below:

    It starts with brief and long descriptions. In the generated docs, the brief description is always at the top of the page, while the long description lies below the list of methods, variables, and constants. You can find methods, member variables, constants, and signals in separate XML nodes.

    For each, you want to learn how they work in Godot’s source code. Then, fill their documentation by completing or improving the text in these tags:

    • <brief_description>

    • <description>

    • <constant>

    • <method> (in its <description> tag; return types and arguments don’t take separate documentation strings)

    • <member>

    • <constant>

    Write in a clear and simple language. Always follow the to keep your descriptions short and easy to read. Do not leave empty lines in the descriptions: each line in the XML file will result in a new paragraph, even if it is empty.

    Edit the file for your chosen class in to update the class reference. The folder contains an XML file for each class. The XML lists the constants and methods you will find in the class reference. Godot generates and updates the XML automatically.

    Note

    For some modules in the engine’s source code, you’ll find the XML files in the modules/<module_name>/doc_classes/ directory instead.

    Edit it using your favorite text editor. If you use a code editor, make sure that it doesn’t change the indent style: you should use tabs for the XML and four spaces inside BBCode-style blocks. More on that below.

    To check that the modifications you’ve made are correct in the generated documentation, navigate to the doc/ folder and run the command make rst. This will convert the XML files to the online documentation’s format and output errors if anything’s wrong.

    Alternatively, you can build Godot and open the modified page in the built-in code reference. To learn how to compile the engine, read the .

    We recommend using a code editor that supports XML files like Vim, Atom, Visual Studio Code, Notepad++, or another to comfortably edit the file. You can also use their search feature to find classes and properties quickly.

    Godot’s class reference supports BBCode-like tags. They add nice formatting to the text. Here’s the list of available tags:

    Use [codeblock] for pre-formatted code blocks. Inside [codeblock], always use four spaces for indentation. The parser will delete tabs. For example:

    1. [codeblock]
    2. func _ready():
    3. print(sprite.get_pos())
    4. [/codeblock]

    Will display as:

    1. func _ready():
    2. var sprite = get_node("Sprite")

    If you need to have different code version in GDScript and C#, use [codeblocks] instead. If you use [codeblocks], you also need to have at least one of the language-specific tags, [gdscript] and .

    Always write GDScript code examples first! You can use this to speed up your workflow.

    The above will display as:

    GDScript   C#

    1. func _ready():
    2. var sprite = get_node("Sprite")
    3. print(sprite.get_pos())
    1. public override void _Ready()
    2. {
    3. var sprite = GetNode("Sprite");
    4. GD.Print(sprite.GetPos());
    5. }

    To denote important information, add a paragraph starting with “[b]Note:[/b]“ at the end of the description:

    To denote crucial information that could cause security issues or loss of data if not followed carefully, add a paragraph starting with “[b]Warning:[/b]“ at the end of the description:

      For deprecated properties, add a paragraph starting with “[i]Deprecated.[/i]“. Notice the use of italics instead of bold:

      1. [i]Deprecated.[/i] This property has been replaced by [member other_property].

      In all the paragraphs described above, make sure the punctuation is part of the BBCode tags for consistency.

      I don’t know what this method does!

      You can still look at the methods’ implementation in Godot’s source code on GitHub. If you have doubts, feel free to ask on the and Godot Contributors Chat.