You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
"> This is one of the 100 recipes of the [IPython Cookbook](http://ipython-books.github.io/), the definitive guide to high-performance scientific computing and data science in Python.\n"
16
-
]
17
-
},
18
-
{
19
-
"cell_type": "markdown",
20
-
"metadata": {},
21
-
"source": [
22
-
"# 3.3. Adding custom controls in the notebook toolbar"
23
-
]
24
-
},
25
-
{
26
-
"cell_type": "markdown",
27
-
"metadata": {},
28
-
"source": [
29
-
"The CSS and Javascript of the HTML notebook can be customized through the files in `~/.ipython/profile_default/static/custom`, where `~` is your `HOME` directory, and `default` is your IPython profile. In this short recipe, we will use this feature to add a new button in the notebook toolbar on top of every notebook. Specifically, this button renumbers linearly all code cells."
30
-
]
31
-
},
32
-
{
33
-
"cell_type": "markdown",
34
-
"metadata": {},
35
-
"source": [
36
-
"1. First, we are going to inject Javascript code directly in the notebook. This is useful for testing purposes, or if you don't want your changes to be permanent. The Javascript code will be loaded with that notebook only. To do this, we can just use the `%%javascript` cell magic."
"// We set the input prompt of all code cells.\n",
69
-
" for (var i = 0; i < cells.length; i++) {\n",
70
-
"cells[i].set_input_prompt(i + 1);\n",
71
-
"}\n",
72
-
"}\n",
73
-
"}]);"
74
-
],
75
-
"language": "python",
76
-
"metadata": {},
77
-
"outputs": []
78
-
},
79
-
{
80
-
"cell_type": "markdown",
81
-
"metadata": {},
82
-
"source": [
83
-
"Running this code cell adds a button in the toolbar. Clicking on this button automatically updates the prompt numbers of all code cells."
84
-
]
85
-
},
86
-
{
87
-
"cell_type": "markdown",
88
-
"metadata": {},
89
-
"source": [
90
-
"2. To make these changes permanent, i.e. to add this button on every notebook open within the current profile, we can open the file `~/.ipython/profile_default/static/custom/custom.js` and add the following code:"
"> This is one of the 100 recipes of the [IPython Cookbook](http://ipython-books.github.io/), the definitive guide to high-performance scientific computing and data science in Python.\n"
16
+
],
17
+
"metadata": {}
18
+
},
19
+
{
20
+
"cell_type": "markdown",
21
+
"source": [
22
+
"# 3.3. Adding custom controls in the notebook toolbar"
23
+
],
24
+
"metadata": {}
25
+
},
26
+
{
27
+
"cell_type": "markdown",
28
+
"source": [
29
+
"The CSS and Javascript of the HTML notebook can be customized through the files in `~/.ipython/profile_default/static/custom`, where `~` is your `HOME` directory, and `default` is your IPython profile. In this short recipe, we will use this feature to add a new button in the notebook toolbar on top of every notebook. Specifically, this button renumbers linearly all code cells."
30
+
],
31
+
"metadata": {}
32
+
},
33
+
{
34
+
"cell_type": "markdown",
35
+
"source": [
36
+
"1. First, we are going to inject Javascript code directly in the notebook. This is useful for testing purposes, or if you don't want your changes to be permanent. The Javascript code will be loaded with that notebook only. To do this, we can just use the `%%javascript` cell magic."
"// We set the input prompt of all code cells.\n",
72
+
" for (var i = 0; i < cells.length; i++) {\n",
73
+
" cells[i].set_input_prompt(i + 1);\n",
74
+
" }\n",
75
+
" }\n",
76
+
"}]);"
77
+
],
78
+
"language": "python"
79
+
},
80
+
{
81
+
"cell_type": "markdown",
82
+
"source": [
83
+
"Running this code cell adds a button in the toolbar. Clicking on this button automatically updates the prompt numbers of all code cells."
84
+
],
85
+
"metadata": {}
86
+
},
87
+
{
88
+
"cell_type": "markdown",
89
+
"source": [
90
+
"2. To make these changes permanent, i.e. to add this button on every notebook open within the current profile, we can open the file `~/.ipython/profile_default/static/custom/custom.js` and add the following code:"
0 commit comments