Sphinx Public API documentation

橙三吉。 提交于 2019-12-04 07:24:09

I'm answering my own question... After some more had searching I found this:

http://sphinx.pocoo.org/ext/autodoc.html#event-autodoc-skip-member

Basically you can define a function in your conf.py file can look at each member and skip all that don't have the right decorator.

here is a little example at the end of my conf.py file (this is the config file for sphinx)

def my_doc_skip(app, what, name, obj, skip, options):
    if what != "method":
        return True

    # if obj is decorated with @api
    #     return True
    # return False

def setup(app):
    app.connect('autodoc-process-docstring', my_process_docstring)
    app.connect('autodoc-skip-member', my_doc_skip)

You can also process the docstring with a function.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!