-
Notifications
You must be signed in to change notification settings - Fork 138
Open
Labels
Description
Hi all, nbsphinx is great!
Just wondering if an nbsphinx option can be added to the sphinx conf to allow nbsphinx to show local line numbers for code blocks? This would make it easier to reference code when writing documentation. In my case, the sphinx documentation is hosted on readthedocs.
Related info:
Setting line numbers in Jupyter notebooks:
Jupyter notebook extension
- Here is a jupyter extension for turning on global line numbers (although I am mainly interested in showing local code block line numbers, as maintaining documentation with global line numbers would be very difficult, unless they automatically update when code above a cell is updated.)
Jupyter notebook github issues/pull requests related to showing line numbers
- Open - Show line number on left side of code cells
- Closed -Adding toggle line numbers for all cells
- Closed - View > Toggle line numbers
The last last link mentions that line numbers can be turned on with the following code. Although, I am unsure of how to use this with nbsphinx.
from notebook.services.config import ConfigManager
c = ConfigManager()
c.update('notebook', {"CodeCell": {"cm_config": {"lineNumbers": True}}})Thanks