1

I want to enable line wrapping and line numbering by default in my IPython notebook. Until recently it all worked well with the answer given in e.g. this post:

How to display line numbers in IPython Notebook code cell by default

Since I updated my IPython notebook to version 3, this setting seems to be ignored. Could you give me a hint on how to enable line wrapping and line numbering in the current version of IPython? My browser mentions a JavaScript error : Uncaught TypeError: Cannot read property 'options_default' of undefined

Thank you!

Community
  • 1
  • 1
asPlankBridge
  • 1,032
  • 1
  • 17
  • 30

1 Answers1

1

I found the answer after looking a bit through the JavaScript console. When you update your IPython notebook from version 2 to 3, and you want line numbers and line wrapping, then change your custom.js content to:

 $([IPython.events]).on('app_initialized.NotebookApp', function(){
    IPython.CodeCell.options_default.cm_config.lineWrapping = true;
    IPython.CodeCell.options_default.cm_config.lineNumbers = true;
 });
asPlankBridge
  • 1,032
  • 1
  • 17
  • 30