Skip to content

Instantly share code, notes, and snippets.

@kingname
Created February 5, 2017 12:29
Show Gist options
  • Save kingname/a29da3919317e37f0f205c380f2bdbac to your computer and use it in GitHub Desktop.
Save kingname/a29da3919317e37f0f205c380f2bdbac to your computer and use it in GitHub Desktop.
add line number for jupyter
/*If you want line numbers only for code cells, there is a simpler approach. Select a code cell, open the Chrome/Firefox JavaScript console, type the following lines:*/
```javascript
var cell = Jupyter.notebook.get_selected_cell();
var config = cell.config;
var patch = {
CodeCell:{
cm_config:{lineNumbers:true}
}
}
config.update(patch)
```
/*
Then reload the page. These changes persist because Jupyter will create a json config file in .jupyter/nbconfig to store them. This method is from this page of the documentation, so read the docs for more config changes that you can make.*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment