我可以使用sphinx.ext.viewcode显示行号吗?
我正在使用 sphinx.ext.viewcode 记录我的API。是否可以在生产的Cod-Block上显示线号,如果是的话?
我试图在文档中找到html_option
,但没有找到任何东西。
I'm using the sphinx.ext.viewcode to document my API. Is it possible to display the line numbers on the produced cod-block and if yes how ?
I've tried to find an html_option
in the docs but I didn't found anything.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
由于我问了这个问题,以下 pr 已合并到sphinx从v7.2.0开始。
要在ViewCode输出中添加行编号,只需将以下参数添加到您的conf.py:
Since I asked this question, the following PR have been merged to Sphinx and is available starting from v7.2.0.
to add the line numbering in a viewcode output, simply add the following parameter to your conf.py: