docs: Migrate from gtk-doc to gi-docgen
gtk-doc has been slowly dying for the past few years; with gi-docgen we have a nice successor.
This also makes sure the C documentation also uses the GIR file, which in turn means faster build times (since all the C code doesn't have to be parsed and recompiled again), and has a clear dependency graph.
See the gi-docgen tutorial for more info on how the system works.
The good
- We build our documentation for C plug-ins using the same input as plug-ins in other languages: using the GIR file
- We can drop a tool which has been unmaintained for years, and even less so as more libraries switch to using gi-docgen
- We have much shorter build times for the documentation, as gtk-doc had to parse all C files and compile them. In Meson, it's even better, as there is now a proper dependency graph, making sure the documentation only gets rebuilt if the GIR file changed.
- We can use MarkDown to format comments and add our documentation files (which means we can just put the GIMP plug-ins porting guide as part of the devel-docs)
- It also supports DevHelp format
- if we ever need to fix a bug, it won't be in a myriad of Python/perl/XML/docbook/... files
The bad
- gi-docgen is relatively new, so it's not packaged yet in Debian stable. Luckily it's exported as a pypi module, so we can just do
python3 install pip
- I've seen some small bugs pop up when using it since it's relatively new, but they usually get resolved relatively quickly
The ugly
- Although gi-docgen understands gtk-doc references (like
#GimpPlugIn
, orgimp_procedure_run()
) and can put these in monospace, if you want to have proper links, you need to use gi-docgen syntax (the examples I just gave become[class@PlugIn]
and[method@Procedure.run]
). I've made an example conversion in "libgimp/gimpplugin.c" and "libgimp/gimpplugin.h"
Edited by Niels De Graef