Skip to content

Showing line numbers for code blocks #478

@PrasadBabarendaGamage

Description

@PrasadBabarendaGamage

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

Jupyter notebook github issues/pull requests related to showing 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions