itch.io is community of indie game creators and players

Devlogs

Outputting Generated GDScript Reference as XML

Node2D Gizmo
A downloadable plugin

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".

Notice: there's a mistake in my bbcode. Can you see it? I should fix that.

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 .
Download Node2D Gizmo
Leave a comment