Are Godot Docs actually "generated as XML?" Can it be exported?

Godot Version

4.5.1

Question

Here, on this tutorial for docstrings (GDScript documentation comments — Godot Engine (stable) documentation in English), it says, “This documentation can be generated as XML files by the editor.” A 2020 progress update about the documentation system implies that it might (at the time, in 2020) one day be able to be exported to HTML or other useful formats to be consumed outside of the editor.

Can I export the docs for my classes, somehow? If not, is there a convenient way to get access to that system from inside the editor to write a converter myself (without having to write a whole c++ extension)?

1 Like

I read through that page, the comments, the linked issues and proposals, and the links to issues and proposals from there.

The page does not indicate whether that XML can be exported outside the editor or not. If it can be, it is worth noting that HTML is XML. And so XML can be converted with a little work using a script into HTML.

@Calinou might know if you can export the docs you make using ## into XML outside the editor.

1 Like

I have found no further reference to HTML, but I have finally discovered how to export them to XML:

/path/to/Godot_v4.5.1-stable_win64_console.exe --doctool /path/to/output/dir --gdscript-docs /path/to/scripts

So now I just have to write a converter.

3 Likes

Did you find that in the docs?

Yes, only in the command line tutorial: Command line tutorial — Godot Engine (stable) documentation in English

Not that hidden away in the end, but not in a place you’d immediately think to look (nor one which comes up on related search terms)

3 Likes

Cool, thanks. I’m going to look into using this to document my addons in the ReadMe.

You can convert the generated XML to reStructuredText using make_rst.py from the Godot repository, then move these generated files to a Sphinx website like GitHub - godotengine/godot-docs: Godot Engine official documentation does for the online class reference. Once you build the website using Sphinx, you’ll get HTML/PDF/ePub files of the documentation.

3 Likes