Sphinx:自动标记标题?
在Sphinx中,是否可以自动定义标题标签?我发现我的文档最终看起来很像这样:
.._doing stuff: Doing Stuff ----------- You might also want :ref:`other stuff`. .._other stuff: Other Stuff ----------- No, you want :ref:`doing stuff`.
删除重复项会很好。
In Sphinx, is it possible to automatically define labels for headings? I've found that my documents end up looking a lot like this:
.._doing stuff: Doing Stuff ----------- You might also want :ref:`other stuff`. .._other stuff: Other Stuff ----------- No, you want :ref:`doing stuff`.
And it would be nice to remove that duplication.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在同一文档中,您始终可以使用传统参考:
但如上所述,此方法不适用于跨文档文件。
Within same document, you can always use the traditional reference:
But as mentioned, this method does not work across the document files.
Sphinx 1.4 添加了
sphinx.ext.autosectionlabel
< /a> 支持这一点。它包括一个选项,可以将文档名称作为标签的前缀,以避免跨文档冲突。Sphinx 1.4 added
sphinx.ext.autosectionlabel
which supports this. It includes an option that will prefix the document name to the label to avoid cross-document clashes.