Use Jupyter Notebook - how code means to enable wrapping

Recently started using  Jupyter Notebook , as for its powerful features I do not need to do too much introduction, then go directly to the topic

In the use of the process I found a question: When editing code is too long scroll bar will appear / slider (like this)

But when I pull the scroll bar in the end, the question arises:  sidebar still obscures part of the code    (like this one)  

The problem with your theme plugin  jupyterthemes  when especially (example uses the theme: monokai, by  pip install jupyterthemes  installation, commissioning theme:  JT -t monokai  )

When using the default official theme is not very clear, basically it does not affect use. But for people who want to use the theme for this issue will undoubtedly cause considerable distress following describes a configuration file by modifying the code units enabled wrap to circumvent the blocking scheme

  1. First, the command  jupyter --config-dir  find where the path to the configuration file, enter a path  nbconfig   (if not, you can create yourself)
  2. Examples of (my configuration file path   C: \ the Users \ DMCs9 \ .jupyter \ nbconfig  )
  3. Find  notebook.json  file (if not, you can create your own), by notepad ++ open the file for editing
  4. Append / write the following code, save and restart  Jupyter Notebook
"MarkdownCell": {
    "cm_config": {
      "lineWrapping": true
    }
  },
  "CodeCell": {
    "cm_config": {
      "lineWrapping": true
    }
  },

This problem will be solved (below is the result of changes to the configuration file)

 

Note: The complete configuration file format (this is mine, for reference purposes only format, and the rest of the configuration may not take effect)

{
  "load_extensions": {
    "nbextensions_configurator/config_menu/main": true,
    "contrib_nbextensions_help_item/main": true,
    "jupyter-js-widgets/extension": true,
    "codefolding/main": true,
    "code_font_size/code_font_size": false,
    "toc2/main": true,
    "scratchpad/main": false,
    "code_prettify/code_prettify": false,
    "autoscroll/main": false,
    "python-markdown/main": false,
    "scroll_down/main": false,
    "snippets/main": false,
    "ruler/main": false,
    "notify/notify": false,
    "hide_input/main": false,
    "freeze/main": false,
    "hide_input_all/main": false,
    "qtconsole/qtconsole": false,
    "code_prettify/autopep8": false
  },
  "MarkdownCell": {
    "cm_config": {
      "lineWrapping": true
    }
  },
  "CodeCell": {
    "cm_config": {
      "lineWrapping": true
    }
  },
  "Cell": {
    "cm_config": {
      "lineNumbers": true
    }
  },
  "Notebook": {
    "Header": true,
    "Toolbar": true
  },
  "toc2": {
    "number_sections": false,
    "skip_h1_title": true,
    "collapse_to_match_collapsible_headings": false
  }
}

 

Guess you like

Origin www.cnblogs.com/dmcs95/p/11299567.html