Skip to main content
 首页 » 编程设计

python之狮身人面像 : Remove package and module name for specific function

2024年10月01日8insus

我的问题与此处的问题非常相似:Remove package and module name from sphinx function

有没有办法只为单个函数或至少为文件中的每个函数删除/隐藏 sphinx 中的包和模块名称(基本上在本地更改全局 conf.py 设置),同时为其余部分显示它们项目的?

我一直在寻找选项,例如自动模块的选项(:members:、:undoc-members: 等),但找不到任何指令来隐藏此信息。

请您参考如下方法:

一种选择是对 cross referencing syntax 使用 reST 标记像这样:

If you prefix the content with ~, the link text will only be the last component of the target. For example,

:py:meth:`~Queue.Queue.get`

will refer to Queue.Queue.get but only display get as the link text.