Outputting Generated GDScript Reference as XML
ETA: https://github.com/godotengine/godot/blob/master/doc/tools/make_rst.py Here's a ready-made tool to convert 'em to rst
I developed Node2D Gizmo to the point of 0.7.0 in almost exactly one week of real time -- since I was unemployed when I started, I estimate I put about three weeks worth of work into it. I say that at the top to explain that when I say that I struggled for days to find a convenient way to distribute documentation, it's more dramatic than it sounds. Especially dramatic, given that the answer is readily available, if you have the right search term. The right search term is "doctools".
It is well-known by everyone who cares about documenting their code that Godot 4 features (effectively) docstrings. I've used docstrings documentation comments extensively to give the interface to Node2D Gizmo a reasonable feel for users. If you're unaware, here's the official tutorial. Simply put, you place a comment (with two pound signs ##) before each member you wish to document. You can format docstrings using BBcode, and the builtin Script Editor will generate a nice-looking Class Reference page for it.
I really want to be able to distribute this documentation as a set of nice HTML files, but I couldn't for the life of me find out how to even get XML out of the engine. I knew it had to be possible! The tutorial features this teasing line right in the first paragraph: this documentation can be generated as XML files by the editor. But the closest I got until recently was a link in an old forum post to this progress report from 2020, suggesting exactly the capability I'm looking for.
But without adding "doctools" to your search terms, it's very hard to find any documentation about this feature. Simultaneously, you won't know about doctools at all until you already have the answer. A catch-22. Hopefully this will come up readily when someone searches for "godot generated docstring xml."
I finally found the first step here: https://docs.godotengine.org/en/stable/tutorials/editor/command_line_tutorial.ht...

You only have to run a command like this:
/path/to/Godot_v4.5.1-stable_win64_console.exe --doctool ./doc --gdscript-docs .
And your output will be as so (less the `img` directory):
In that progress report from 2020, the words "could be" seem to have been operative when discussing export to HTML... The next step is to write a python script to convert from these XML files. And/or convert to reST and learn to use Sphinx.
Get Node2D Gizmo
Node2D Gizmo
Tool for Godot 4.3+ to easily add 2D gizmos to your own plugins and custom nodes, and a rotation gizmo for all Node2Ds
| Status | In development |
| Category | Tool |
| Author | skyebee |
| Tags | 2D, Game Design, Godot, Level Editor, plugin |
| Languages | English |
More posts
- v0.8.0 Target Release Date: 2/162 days ago
- 0.8.0 Demonstration22 days ago
- Persistency Achieved36 days ago
- New Year Progress40 days ago
- V0.7.0 Release and Roadmap48 days ago

Leave a comment
Log in with itch.io to leave a comment.