How to get Python Sphinx documentation in data-only format?

I am working on a very large code base that uses sphinx-apidoc to automatically generate HTML documentation from docstrings in a Python source. Dockstones use the following format:

: param message: message to display
: type message: string
: returns: formatted string
: rtype: string

It becomes a requirement to replace the Sphinx HTML documentation with something organized / presented in different ways, but we still want to automatically generate from our docstrings in the source. Is there a way to generate documentation in an intermediate format (like xml) with Sphinx? I have not found a way to do this. Does anyone know what I can do?

+4
source share
1 answer

You could use a json builder instead of an HTML constructor that would generate JSON syntax output. Alternate, you can write your own builder to create the desired format (see http://sphinx.pocoo.org/builders.html for the current list of builders).

+6
source

Source: https://habr.com/ru/post/1442362/


All Articles