IPyLogbook Extensions

This IPython notebook can be used to configure the IPython-notebook-extensions that are used to enhance the IPyLogbook system. The user can choose which extensions will be loaded automatically when the notebook server is started. A customized version of the IPython-notebook-extensions should be installed in the .ipython/nbextensions directory in order to be used. A custom version is primarily being used to correct bugs found in the official GitHub development version.

The user should be warned that the python-markdown extension is crucial to ensure that URLs with the Markdown cells are correctly set!

To configure extensions:

  1. Set each of the extension flags in the following cell to 'True' (enabled) or 'None' (disabled)
  2. Run all cells via the Cell $\rightarrow$ Run All menu option
  3. Save the notebook via the File $\rightarrow$ Save and Checkpoint menu option or the Ctrl-s key binding
  4. Restart the IPython notebook server for changes to take affect

In [1]:
# Enable Python variables to by inserted into Markdown cells via the "{{}}" syntax
use_python_markdown = True

# Enable cells to be 'read-only' via 'lock' click button up above-right
use_read_only = True

# Enable all input cells to be hidden via ' bars'click button above-right
use_hide_input_all = True

# Enable png/jpg images to be added to notebook by drag-and-drop
use_drag_and_drop = True

Load IPython-notebook-extensions


In [2]:
import IPython
from IPython.html.services.config import ConfigManager

ip=IPython.get_ipython()
ip.ipython_dir

extensions_dir = "IPython-notebook-extensions-master/"

python_markdown = extensions_dir + "usability/python-markdown"
drag_and_drop = extensions_dir + "usability/dragdrop/drag-and-drop"
read_only = extensions_dir + "usability/read-only"
hide_input_all = extensions_dir + "usability/hide_input_all"

cm = ConfigManager(parent=ip, profile_dir=ip.profile_dir.location)
cm.update('notebook', {"load_extensions": {python_markdown: use_python_markdown}})
cm.update('notebook', {"load_extensions": {drag_and_drop: use_drag_and_drop}})
cm.update('notebook', {"load_extensions": {read_only: use_read_only}})
cm.update('notebook', {"load_extensions": {hide_input_all: use_hide_input_all}})


Out[2]:
{u'load_extensions': {u'IPython-notebook-extensions-master/usability/dragdrop/drag-and-drop': True,
  u'IPython-notebook-extensions-master/usability/hide_input_all': True,
  u'IPython-notebook-extensions-master/usability/python-markdown': True,
  u'IPython-notebook-extensions-master/usability/read-only': True}}

List IPython-notebook-extensions


In [3]:
import IPython
from IPython.html.services.config import ConfigManager
from IPython.html.services.config import ConfigManager
from IPython.display import HTML
cm = ConfigManager(parent=ip, profile_dir=ip.profile_dir.location)
extensions = cm.get('notebook')
table = ""
for ext in extensions['load_extensions']:
    table += "<tr><td>%s</td>\n" % (ext)

top = """
<table border="1">
  <tr>
    <th>The following extensions will be automatically loaded by IPyLogbook:</th>
  </tr>
"""
bottom = """
</table>
"""
HTML(top + table + bottom)


Out[3]:
The following extensions will be automatically loaded by IPyLogbook:
IPython-notebook-extensions-master/usability/read-only
IPython-notebook-extensions-master/usability/python-markdown
IPython-notebook-extensions-master/usability/dragdrop/drag-and-drop
IPython-notebook-extensions-master/usability/hide_input_all

In [3]: