Customize templates for `sphinx-apidoc`

前端 未结 3 1499
天命终不由人
天命终不由人 2020-12-03 02:01

I\'ve recently tried using sphinx-apidoc from Sphinx to help generate Sphinx specific reStructuredText from the API of a Python project.

However, the result I\'m get

3条回答
  •  时光说笑
    2020-12-03 02:06

    The sphinx-apidoc script uses the apidoc.py module. I am not able to provide detailed instructions, but in order to remove headings or otherwise customize the output, you'll have to write your own version of this module. There is no other "template".

    Note that if the API and module structure is stable, there is no need to run sphinx-apidoc repeatedly. You can post-process the generated rst files to your liking once and then place them under version control. See also https://stackoverflow.com/a/28481785/407651.

    Update

    From Sphinx 2.2.0, sphinx-apidoc supports templates. See https://stackoverflow.com/a/57520238/407651.

提交回复
热议问题