如何自定义sphinx.ext.autosummary rst模板?

act*_*ess 5 python python-sphinx

这里狮身人面像的文档中有人说什么这些模板可以重新定义.于是,我就复制module.rst来自/site-packages/sphinx/ext/autosummarysource/_templates/autosummary(也尝试过source/_templates),还有一些细微的变化.但在我重新生成文档后,没有任何改变.

也许我应该添加一些特定的选项来.. autosummary::标记以指定自定义模板目录?(在conf.py目录中设置正确,sphinx也查看html模板)

UPD:源代码https://github.com/actionless/wooper/blob/debug-autosummary/docs.sh

mzj*_*zjn 6

如果您执行以下操作,它应该会起作用:

  1. 确保templates_path配置变量的值在 conf py.conf 中设置为['_templates']
  2. 将自定义模板放在_templates子目录中。
  3. 使用:template: 选项:

    .. autosummary::
      :template: mytemplate.rst
    
    Run Code Online (Sandbox Code Playgroud)