New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
nbconvert line numbers #5847
Milestone
Comments
Not with a command-line arg, but a custom nbconvert template and filter could get you line numbers with pygments. To get pygments HTML with line numbers, specify the formatter = pygments.formatters.get_formatter_by_name('html', linenos='inline') |
yuvipanda
added a commit
to yuvipanda/nbconvert
that referenced
this issue
Dec 1, 2021
I primarily want to allow for the possibility of line numbers in HTML output. Pygments supports this natively, but we don't have a way to pass arguments through to pygments. A traitlet is added to allow passing arbitrary extra args to the Pygments formatter, for Html and LaTeX. Should allow for line number control and much more :) This has been something folks have asked for for a while. Ref ipython/ipython#5847 Ref jupyter#427 Ref yuvipanda/notebooksharing.space#34
SylvainCorlay
pushed a commit
to jupyter/nbconvert
that referenced
this issue
Dec 2, 2021
I primarily want to allow for the possibility of line numbers in HTML output. Pygments supports this natively, but we don't have a way to pass arguments through to pygments. A traitlet is added to allow passing arbitrary extra args to the Pygments formatter, for Html and LaTeX. Should allow for line number control and much more :) This has been something folks have asked for for a while. Ref ipython/ipython#5847 Ref #427 Ref yuvipanda/notebooksharing.space#34
Thanks to jupyter/nbconvert#1683, you can now do this with:
Might need to wait for a release of nbconvert though. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
As far as I can tell from scouring the documentation and man pages, it's not possible to have nbconvert create line numbers when converting to html. Is this a feature thats implementable? Is there a DIY alternative?
The text was updated successfully, but these errors were encountered: