I am using Sphinx to document parts of Javascript code on a web page.
I use
.. literalinclude:: ../examples/mapviz-step1-simple.html
:language: javascript
:lines: 47-51
:linenos:
I get
The code snippet comes from lines 47-51 of the actual source code file, not 1-5.
How can I display the actual line numbers along with this snippet of code?
This was not possible when the question was asked in 2011, but since Sphinx 1.3 there is lineno-start
option. See this enhancement request: https://github.com/sphinx-doc/sphinx/issues/668.
Current documentation:
literalinclude
code-block
Sphinx 1.3 will have lineno-start
feature available just for this purpose.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With