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:
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
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]:
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]:
In [3]: