Sphinx,literalinclude,linenos:如何在doc的代码片段中显示源代码文件中的实际行号?

b_d*_*dev 5 python-sphinx

我正在使用Sphinx在网页上记录部分Javascript代码.

我用

.. literalinclude:: ../examples/mapviz-step1-simple.html
   :language: javascript
   :lines: 47-51
   :linenos:
Run Code Online (Sandbox Code Playgroud)

我明白了

在此输入图像描述

代码片段来自实际源代码文件的第47-51行,而不是1-5.

如何显示实际行号以及此代码段?

mzj*_*zjn 7

当问题在2011年被问到时,这是不可能的,但现在有一个lineno-start功能(在Sphinx 1.3中添加).请参阅此增强请求:https://github.com/sphinx-doc/sphinx/issues/668.