Sphinx apidoc - don't print full path to packages and modules

后端 未结 1 629
逝去的感伤
逝去的感伤 2020-12-31 03:37

I am quite new to sphinx and I am trying to use it as API reference for my project. Maybe after that as project documentation too.

I generate it using these two comm

1条回答
  •  借酒劲吻你
    2020-12-31 04:01

    As far as the table of contents goes, doing a search/replace in the source folder on all the *.rst files (after running sphinx-apidoc) is what finally worked for me.

    search:

    ^(?:[a-zA-Z0-9]*[.])*([a-zA-Z0-9]+) (package|module)
    

    replace:

    \1 \2
    

    ...this shortens the title, which is what is displayed in the toctree. The only consequence is the title on that module's page will be the short name as well, but that didn't bother me since both the navigation and table of contents still make it clear what the parent package is.

    As per the class/function names, mzjin's comment to the question:

    set add_module_names = False in conf.py

    should do the trick.

    0 讨论(0)
提交回复
热议问题