##// END OF EJS Templates
@Carreau 's review comments.
Jonathan Frederic -
Show More
@@ -1,317 +1,317 b''
1 {
1 {
2 "cells": [
2 "cells": [
3 {
3 {
4 "cell_type": "markdown",
4 "cell_type": "markdown",
5 "metadata": {},
5 "metadata": {},
6 "source": [
6 "source": [
7 "# NbConvert"
7 "# NbConvert"
8 ]
8 ]
9 },
9 },
10 {
10 {
11 "cell_type": "markdown",
11 "cell_type": "markdown",
12 "metadata": {},
12 "metadata": {},
13 "source": [
13 "source": [
14 "## Command line usage"
14 "## Command line usage"
15 ]
15 ]
16 },
16 },
17 {
17 {
18 "cell_type": "markdown",
18 "cell_type": "markdown",
19 "metadata": {},
19 "metadata": {},
20 "source": [
20 "source": [
21 "`NbConvert` is both a library and command line tool that allows you to convert notebooks to other formats. It ships with many common formats: `html`, `latex`, `markdown`, `python`, `rst`, and `slides`\n",
21 "`NbConvert` is both a library and command line tool that allows you to convert notebooks to other formats. It ships with many common formats: `html`, `latex`, `markdown`, `python`, `rst`, and `slides`\n",
22 "NbConvert relys on the Jinja templating engine, so implementing a new format or tweeking an existing one is easy."
22 "NbConvert relys on the Jinja templating engine, so implementing a new format or tweeking an existing one is easy."
23 ]
23 ]
24 },
24 },
25 {
25 {
26 "cell_type": "markdown",
26 "cell_type": "markdown",
27 "metadata": {},
27 "metadata": {},
28 "source": [
28 "source": [
29 "You can invoke nbconvert by running\n",
29 "You can invoke nbconvert by running\n",
30 "\n",
30 "\n",
31 "```bash\n",
31 "```bash\n",
32 "$ ipython nbconvert <options and arguments>\n",
32 "$ ipython nbconvert <options and arguments>\n",
33 "```\n",
33 "```\n",
34 "\n",
34 "\n",
35 "Call `ipython nbconvert` with the `--help` flag or without any aruments to display the basic help. For detailed configuration help, use the `--help-all` flag."
35 "Call `ipython nbconvert` with the `--help` flag or without any aruments to display the basic help. For detailed configuration help, use the `--help-all` flag."
36 ]
36 ]
37 },
37 },
38 {
38 {
39 "cell_type": "markdown",
39 "cell_type": "markdown",
40 "metadata": {},
40 "metadata": {},
41 "source": [
41 "source": [
42 "### Basic export"
42 "### Basic export"
43 ]
43 ]
44 },
44 },
45 {
45 {
46 "cell_type": "markdown",
46 "cell_type": "markdown",
47 "metadata": {},
47 "metadata": {},
48 "source": [
48 "source": [
49 "As a test, the `Index.ipynb` notebook in the directory will be convert. \n",
49 "As a test, the `Index.ipynb` notebook in the directory will be convert. \n",
50 "\n",
50 "\n",
51 "If you're converting a notebook with code in it, make sure to run the code cells that you're interested in before attempting to convert the notebook. Nbconvert **does not execute the code cell** of the notebooks that it converts."
51 "If you're converting a notebook with code in it, make sure to run the code cells that you're interested in before attempting to convert the notebook. Unless explicitly requested, nbconvert **does not execute the code cells** of the notebooks that it converts."
52 ]
52 ]
53 },
53 },
54 {
54 {
55 "cell_type": "code",
55 "cell_type": "code",
56 "execution_count": null,
56 "execution_count": null,
57 "metadata": {
57 "metadata": {
58 "collapsed": false
58 "collapsed": false
59 },
59 },
60 "outputs": [],
60 "outputs": [],
61 "source": [
61 "source": [
62 "%%bash\n",
62 "%%bash\n",
63 "ipython nbconvert 'Index.ipynb'"
63 "ipython nbconvert 'Index.ipynb'"
64 ]
64 ]
65 },
65 },
66 {
66 {
67 "cell_type": "markdown",
67 "cell_type": "markdown",
68 "metadata": {},
68 "metadata": {},
69 "source": [
69 "source": [
70 "Html is the (configurable) default value. The verbose form of the same command as above is "
70 "Html is the (configurable) default value. The verbose form of the same command as above is "
71 ]
71 ]
72 },
72 },
73 {
73 {
74 "cell_type": "code",
74 "cell_type": "code",
75 "execution_count": null,
75 "execution_count": null,
76 "metadata": {
76 "metadata": {
77 "collapsed": false
77 "collapsed": false
78 },
78 },
79 "outputs": [],
79 "outputs": [],
80 "source": [
80 "source": [
81 "%%bash\n",
81 "%%bash\n",
82 "ipython nbconvert --to=html 'Index.ipynb'"
82 "ipython nbconvert --to=html 'Index.ipynb'"
83 ]
83 ]
84 },
84 },
85 {
85 {
86 "cell_type": "markdown",
86 "cell_type": "markdown",
87 "metadata": {},
87 "metadata": {},
88 "source": [
88 "source": [
89 "You can also convert to latex, which will extract the embeded images. If the embeded images are SVGs, inkscape is used to convert them to pdf:"
89 "You can also convert to latex, which will extract the embeded images. If the embeded images are SVGs, inkscape is used to convert them to pdf:"
90 ]
90 ]
91 },
91 },
92 {
92 {
93 "cell_type": "code",
93 "cell_type": "code",
94 "execution_count": null,
94 "execution_count": null,
95 "metadata": {
95 "metadata": {
96 "collapsed": false
96 "collapsed": false
97 },
97 },
98 "outputs": [],
98 "outputs": [],
99 "source": [
99 "source": [
100 "%%bash\n",
100 "%%bash\n",
101 "ipython nbconvert --to=latex 'Index.ipynb'"
101 "ipython nbconvert --to=latex 'Index.ipynb'"
102 ]
102 ]
103 },
103 },
104 {
104 {
105 "cell_type": "markdown",
105 "cell_type": "markdown",
106 "metadata": {},
106 "metadata": {},
107 "source": [
107 "source": [
108 "Note that the latex conversion creates latex, not a PDF. To create a PDF you need the required third party packages to compile the latex.\n",
108 "Note that the latex conversion creates latex, not a PDF. To create a PDF you need the required third party packages to compile the latex.\n",
109 "\n",
109 "\n",
110 "A `--post` flag is provided for convinience which allows you to have nbconvert automatically compile a PDF for you from your output."
110 "A `--post` flag is provided for convinience which allows you to have nbconvert automatically compile a PDF for you from your output."
111 ]
111 ]
112 },
112 },
113 {
113 {
114 "cell_type": "code",
114 "cell_type": "code",
115 "execution_count": null,
115 "execution_count": null,
116 "metadata": {
116 "metadata": {
117 "collapsed": false
117 "collapsed": false
118 },
118 },
119 "outputs": [],
119 "outputs": [],
120 "source": [
120 "source": [
121 "%%bash\n",
121 "%%bash\n",
122 "ipython nbconvert --to=latex 'Index.ipynb' --post=pdf"
122 "ipython nbconvert --to=latex 'Index.ipynb' --post=pdf"
123 ]
123 ]
124 },
124 },
125 {
125 {
126 "cell_type": "markdown",
126 "cell_type": "markdown",
127 "metadata": {},
127 "metadata": {},
128 "source": [
128 "source": [
129 "## Custom templates"
129 "## Custom templates"
130 ]
130 ]
131 },
131 },
132 {
132 {
133 "cell_type": "markdown",
133 "cell_type": "markdown",
134 "metadata": {},
134 "metadata": {},
135 "source": [
135 "source": [
136 "Look at the first 20 lines of the `python` exporter"
136 "Look at the first 20 lines of the `python` exporter"
137 ]
137 ]
138 },
138 },
139 {
139 {
140 "cell_type": "code",
140 "cell_type": "code",
141 "execution_count": null,
141 "execution_count": null,
142 "metadata": {
142 "metadata": {
143 "collapsed": false
143 "collapsed": false
144 },
144 },
145 "outputs": [],
145 "outputs": [],
146 "source": [
146 "source": [
147 "pyfile = !ipython nbconvert --to python 'Index.ipynb' --stdout\n",
147 "pyfile = !ipython nbconvert --to python 'Index.ipynb' --stdout\n",
148 "for l in pyfile[20:40]:\n",
148 "for l in pyfile[20:40]:\n",
149 " print l"
149 " print l"
150 ]
150 ]
151 },
151 },
152 {
152 {
153 "cell_type": "markdown",
153 "cell_type": "markdown",
154 "metadata": {},
154 "metadata": {},
155 "source": [
155 "source": [
156 "From the code, you can see that non-code cells are also exported. If you want to change this behavior, you can use a custom template. The custom template inherits from the Python template and overwrites the markdown blocks so that they are empty."
156 "From the code, you can see that non-code cells are also exported. If you want to change this behavior, you can use a custom template. The custom template inherits from the Python template and overwrites the markdown blocks so that they are empty."
157 ]
157 ]
158 },
158 },
159 {
159 {
160 "cell_type": "code",
160 "cell_type": "code",
161 "execution_count": null,
161 "execution_count": null,
162 "metadata": {
162 "metadata": {
163 "collapsed": false
163 "collapsed": false
164 },
164 },
165 "outputs": [],
165 "outputs": [],
166 "source": [
166 "source": [
167 "%%writefile simplepython.tpl\n",
167 "%%writefile simplepython.tpl\n",
168 "{% extends 'python.tpl'%}\n",
168 "{% extends 'python.tpl'%}\n",
169 "\n",
169 "\n",
170 "{% block markdowncell -%}\n",
170 "{% block markdowncell -%}\n",
171 "{% endblock markdowncell %}\n",
171 "{% endblock markdowncell %}\n",
172 "\n",
172 "\n",
173 "## we also want to get rig of header cell\n",
173 "## we also want to get rig of header cell\n",
174 "{% block headingcell -%}\n",
174 "{% block headingcell -%}\n",
175 "{% endblock headingcell %}\n",
175 "{% endblock headingcell %}\n",
176 "\n",
176 "\n",
177 "## and let's change the appearance of input prompt\n",
177 "## and let's change the appearance of input prompt\n",
178 "{% block in_prompt %}\n",
178 "{% block in_prompt %}\n",
179 "# This was input cell with prompt number : {{ cell.prompt_number if cell.prompt_number else ' ' }}\n",
179 "# This was input cell with prompt number : {{ cell.prompt_number if cell.prompt_number else ' ' }}\n",
180 "{%- endblock in_prompt %}"
180 "{%- endblock in_prompt %}"
181 ]
181 ]
182 },
182 },
183 {
183 {
184 "cell_type": "code",
184 "cell_type": "code",
185 "execution_count": null,
185 "execution_count": null,
186 "metadata": {
186 "metadata": {
187 "collapsed": false
187 "collapsed": false
188 },
188 },
189 "outputs": [],
189 "outputs": [],
190 "source": [
190 "source": [
191 "pyfile = !ipython nbconvert --to python 'Index.ipynb' --stdout --template=simplepython.tpl\n",
191 "pyfile = !ipython nbconvert --to python 'Index.ipynb' --stdout --template=simplepython.tpl\n",
192 "\n",
192 "\n",
193 "for l in pyfile[4:40]:\n",
193 "for l in pyfile[4:40]:\n",
194 " print l\n",
194 " print l\n",
195 "print '...'"
195 "print '...'"
196 ]
196 ]
197 },
197 },
198 {
198 {
199 "cell_type": "markdown",
199 "cell_type": "markdown",
200 "metadata": {},
200 "metadata": {},
201 "source": [
201 "source": [
202 "For details about the template syntax, refer to [Jinja's manual](http://jinja.pocoo.org/docs/dev/)."
202 "For details about the template syntax, refer to [Jinja's manual](http://jinja2.readthedocs.org/en/latest/intro.html)."
203 ]
203 ]
204 },
204 },
205 {
205 {
206 "cell_type": "markdown",
206 "cell_type": "markdown",
207 "metadata": {},
207 "metadata": {},
208 "source": [
208 "source": [
209 "## Template that use cells metadata"
209 "## Template that use cells metadata"
210 ]
210 ]
211 },
211 },
212 {
212 {
213 "cell_type": "markdown",
213 "cell_type": "markdown",
214 "metadata": {},
214 "metadata": {},
215 "source": [
215 "source": [
216 "The notebook file format supports attaching arbitrary JSON metadata to each cell. Here, as an exercise, you will use the metadata to tags cells."
216 "The notebook file format supports attaching arbitrary JSON metadata to each cell. Here, as an exercise, you will use the metadata to tags cells."
217 ]
217 ]
218 },
218 },
219 {
219 {
220 "cell_type": "markdown",
220 "cell_type": "markdown",
221 "metadata": {},
221 "metadata": {},
222 "source": [
222 "source": [
223 "First you need to choose another notebook you want to convert to html, and tag some of the cell with metadata. You can refere to the file `soln/celldiff.js` as an example or follow the Javascript tutorial to figure out how do change cell metadata. Assuming you have a notebook with some of the cells tagged as `Easy`|`Medium`|`Hard`|`<None>`, the notebook can be converted specially using a custom template. Design your remplate in the cells provided below.\n",
223 "First you need to choose another notebook you want to convert to html, and tag some of the cells with metadata. You can refere to the file `soln/celldiff.js` as an example or follow the Javascript tutorial to figure out how do change cell metadata. Assuming you have a notebook with some of the cells tagged as `Easy`|`Medium`|`Hard`|`<None>`, the notebook can be converted specially using a custom template. Design your remplate in the cells provided below.\n",
224 "\n",
224 "\n",
225 "The following, unorganized lines of code, may be of help:"
225 "The following, unorganized lines of code, may be of help:"
226 ]
226 ]
227 },
227 },
228 {
228 {
229 "cell_type": "markdown",
229 "cell_type": "markdown",
230 "metadata": {},
230 "metadata": {},
231 "source": [
231 "source": [
232 "```\n",
232 "```\n",
233 "{% extends 'html_full.tpl'%}\n",
233 "{% extends 'html_full.tpl'%}\n",
234 "{% block any_cell %}\n",
234 "{% block any_cell %}\n",
235 "{{ super() }}\n",
235 "{{ super() }}\n",
236 "<div style=\"background-color:red\">\n",
236 "<div style=\"background-color:red\">\n",
237 "<div style='background-color:orange'>\n",
237 "<div style='background-color:orange'>\n",
238 "```\n",
238 "```\n",
239 "\n",
239 "\n",
240 "If your key name under `cell.metadata.example.difficulty`, the following code would get the value of it:\n",
240 "If your key name under `cell.metadata.example.difficulty`, the following code would get the value of it:\n",
241 "\n",
241 "\n",
242 "`cell['metadata'].get('example',{}).get('difficulty','')`\n",
242 "`cell['metadata'].get('example',{}).get('difficulty','')`\n",
243 "\n",
243 "\n",
244 "Tip: Use `%%writefile` to edit the template in the notebook."
244 "Tip: Use `%%writefile` to edit the template in the notebook."
245 ]
245 ]
246 },
246 },
247 {
247 {
248 "cell_type": "code",
248 "cell_type": "code",
249 "execution_count": null,
249 "execution_count": null,
250 "metadata": {
250 "metadata": {
251 "collapsed": false
251 "collapsed": false
252 },
252 },
253 "outputs": [],
253 "outputs": [],
254 "source": [
254 "source": [
255 "%%bash\n",
255 "%%bash\n",
256 "# ipython nbconvert --to html <your chosen notebook.ipynb> --template=<your template file>"
256 "# ipython nbconvert --to html <your chosen notebook.ipynb> --template=<your template file>"
257 ]
257 ]
258 },
258 },
259 {
259 {
260 "cell_type": "code",
260 "cell_type": "code",
261 "execution_count": null,
261 "execution_count": null,
262 "metadata": {
262 "metadata": {
263 "collapsed": false
263 "collapsed": false
264 },
264 },
265 "outputs": [],
265 "outputs": [],
266 "source": [
266 "source": [
267 "%loadpy soln/coloreddiff.tpl"
267 "%loadpy soln/coloreddiff.tpl"
268 ]
268 ]
269 },
269 },
270 {
270 {
271 "cell_type": "code",
271 "cell_type": "code",
272 "execution_count": null,
272 "execution_count": null,
273 "metadata": {
273 "metadata": {
274 "collapsed": false
274 "collapsed": false
275 },
275 },
276 "outputs": [],
276 "outputs": [],
277 "source": [
277 "source": [
278 "# ipython nbconvert --to html '04 - Custom Display Logic.ipynb' --template=soln/coloreddiff.tpl"
278 "# ipython nbconvert --to html '04 - Custom Display Logic.ipynb' --template=soln/coloreddiff.tpl"
279 ]
279 ]
280 },
280 },
281 {
281 {
282 "cell_type": "markdown",
282 "cell_type": "markdown",
283 "metadata": {},
283 "metadata": {},
284 "source": [
284 "source": [
285 "### Get rid of all command line flags."
285 "### Get rid of all command line flags."
286 ]
286 ]
287 },
287 },
288 {
288 {
289 "cell_type": "markdown",
289 "cell_type": "markdown",
290 "metadata": {},
290 "metadata": {},
291 "source": [
291 "source": [
292 "IPython nbconvert can be configured using the default profile and by selecting a non-default a profile via `--profile` flag. Additionally, if a `config.py` file exist in current working directory, nbconvert will use that as config."
292 "IPython nbconvert can be configured using the default profile or a profile specified via the `--profile` flag. Additionally, if a `config.py` file exist in current working directory, nbconvert will use that as config."
293 ]
293 ]
294 }
294 }
295 ],
295 ],
296 "metadata": {
296 "metadata": {
297 "kernelspec": {
297 "kernelspec": {
298 "display_name": "Python 3",
298 "display_name": "Python 3",
299 "language": "python",
299 "language": "python",
300 "name": "python3"
300 "name": "python3"
301 },
301 },
302 "language_info": {
302 "language_info": {
303 "codemirror_mode": {
303 "codemirror_mode": {
304 "name": "ipython",
304 "name": "ipython",
305 "version": 3
305 "version": 3
306 },
306 },
307 "file_extension": ".py",
307 "file_extension": ".py",
308 "mimetype": "text/x-python",
308 "mimetype": "text/x-python",
309 "name": "python",
309 "name": "python",
310 "nbconvert_exporter": "python",
310 "nbconvert_exporter": "python",
311 "pygments_lexer": "ipython3",
311 "pygments_lexer": "ipython3",
312 "version": "3.4.3"
312 "version": "3.4.3"
313 }
313 }
314 },
314 },
315 "nbformat": 4,
315 "nbformat": 4,
316 "nbformat_minor": 0
316 "nbformat_minor": 0
317 }
317 }
@@ -1,313 +1,313 b''
1 {
1 {
2 "cells": [
2 "cells": [
3 {
3 {
4 "cell_type": "markdown",
4 "cell_type": "markdown",
5 "metadata": {},
5 "metadata": {},
6 "source": [
6 "source": [
7 "# Notebook Basics"
7 "# Notebook Basics"
8 ]
8 ]
9 },
9 },
10 {
10 {
11 "cell_type": "markdown",
11 "cell_type": "markdown",
12 "metadata": {},
12 "metadata": {},
13 "source": [
13 "source": [
14 "## Running the Notebook Server"
14 "## Running the Notebook Server"
15 ]
15 ]
16 },
16 },
17 {
17 {
18 "cell_type": "markdown",
18 "cell_type": "markdown",
19 "metadata": {},
19 "metadata": {},
20 "source": [
20 "source": [
21 "The IPython notebook server is a custom web server that runs the notebook web application. Most of the time, users run the notebook server on their local computer using IPython's command line interface."
21 "The IPython notebook server is a custom web server that runs the notebook web application. Most of the time, users run the notebook server on their local computer using IPython's command line interface."
22 ]
22 ]
23 },
23 },
24 {
24 {
25 "cell_type": "markdown",
25 "cell_type": "markdown",
26 "metadata": {},
26 "metadata": {},
27 "source": [
27 "source": [
28 "### Starting the notebook server using the command line"
28 "### Starting the notebook server using the command line"
29 ]
29 ]
30 },
30 },
31 {
31 {
32 "cell_type": "markdown",
32 "cell_type": "markdown",
33 "metadata": {},
33 "metadata": {},
34 "source": [
34 "source": [
35 "You can start the notebook server from the command line (Terminal on Mac/Linux, CMD prompt on Windows) by running the following command: \n",
35 "You can start the notebook server from the command line (Terminal on Mac/Linux, CMD prompt on Windows) by running the following command: \n",
36 "\n",
36 "\n",
37 " ipython notebook\n",
37 " ipython notebook\n",
38 "\n",
38 "\n",
39 "This will print some information about the notebook server in your terminal, including the URL of the web application (by default, `http://127.0.0.1:8888`). It will then open your default web browser to this URL.\n",
39 "This will print some information about the notebook server in your terminal, including the URL of the web application (by default, `http://127.0.0.1:8888`). It will then open your default web browser to this URL.\n",
40 "\n",
40 "\n",
41 "When the notebook opens, you will see the **notebook dashboard**, which will show a list of the notebooks and subdirectories in the directory where the notebook server was started (as seen in the next section, below). Most of the time, you will want to start a notebook server in the highest directory in your filesystem where notebooks can be found. Often this will be your home directory."
41 "When the notebook opens, you will see the **notebook dashboard**, which will show a list of the notebooks, files, and subdirectories in the directory where the notebook server was started (as seen in the next section, below). Most of the time, you will want to start a notebook server in the highest directory in your filesystem where notebooks can be found. Often this will be your home directory."
42 ]
42 ]
43 },
43 },
44 {
44 {
45 "cell_type": "markdown",
45 "cell_type": "markdown",
46 "metadata": {},
46 "metadata": {},
47 "source": [
47 "source": [
48 "### Additional options"
48 "### Additional options"
49 ]
49 ]
50 },
50 },
51 {
51 {
52 "cell_type": "markdown",
52 "cell_type": "markdown",
53 "metadata": {},
53 "metadata": {},
54 "source": [
54 "source": [
55 "You can start more than one notebook server at the same time. By default, the first notebook server starts on port 8888 and later notebook servers search for open ports near that one.\n",
55 "You can start more than one notebook server at the same time. By default, the first notebook server starts on port 8888 and later notebook servers search for open ports near that one.\n",
56 "\n",
56 "\n",
57 "You can also specify the port manually:\n",
57 "You can also specify the port manually:\n",
58 "\n",
58 "\n",
59 " ipython notebook --port 9999\n",
59 " ipython notebook --port 9999\n",
60 "\n",
60 "\n",
61 "Or start notebook server without opening a web browser.\n",
61 "Or start notebook server without opening a web browser.\n",
62 "\n",
62 "\n",
63 " ipython notebook --no-browser\n",
63 " ipython notebook --no-browser\n",
64 "\n",
64 "\n",
65 "The notebook server has a number of other command line arguments that can be displayed with the `--help` flag: \n",
65 "The notebook server has a number of other command line arguments that can be displayed with the `--help` flag: \n",
66 "\n",
66 "\n",
67 " ipython notebook --help"
67 " ipython notebook --help"
68 ]
68 ]
69 },
69 },
70 {
70 {
71 "cell_type": "markdown",
71 "cell_type": "markdown",
72 "metadata": {},
72 "metadata": {},
73 "source": [
73 "source": [
74 "## The Notebook dashboard"
74 "## The Notebook dashboard"
75 ]
75 ]
76 },
76 },
77 {
77 {
78 "cell_type": "markdown",
78 "cell_type": "markdown",
79 "metadata": {},
79 "metadata": {},
80 "source": [
80 "source": [
81 "When you first start the notebook server, your browser will open to the notebook dashboard. The dashboard serves as a home page for the notebook. Its main purpose is to display the notebooks and files in the current directory. For example, here is a screenshot of the dashboard page for the `examples` directory in the IPython repository:\n",
81 "When you first start the notebook server, your browser will open to the notebook dashboard. The dashboard serves as a home page for the notebook. Its main purpose is to display the notebooks and files in the current directory. For example, here is a screenshot of the dashboard page for the `examples` directory in the IPython repository:\n",
82 "\n",
82 "\n",
83 "<img src=\"images/dashboard_files_tab.png\" width=\"791px\"/>"
83 "<img src=\"images/dashboard_files_tab.png\" width=\"791px\"/>"
84 ]
84 ]
85 },
85 },
86 {
86 {
87 "cell_type": "markdown",
87 "cell_type": "markdown",
88 "metadata": {},
88 "metadata": {},
89 "source": [
89 "source": [
90 "The top of the notebook list displays clickable breadcrumbs of the current directory. By clicking on these breadcrumbs or on sub-directories in the notebook list, you can navigate your file system.\n",
90 "The top of the notebook list displays clickable breadcrumbs of the current directory. By clicking on these breadcrumbs or on sub-directories in the notebook list, you can navigate your file system.\n",
91 "\n",
91 "\n",
92 "To create a new notebook, click on the \"New\" button at the top of the list and select a kernel from the dropdown (as seen below). Which kernels are listed depend on what's installed on the server. Some of the kernels in the screenshot below may not exist as an option to you.\n",
92 "To create a new notebook, click on the \"New\" button at the top of the list and select a kernel from the dropdown (as seen below). Which kernels are listed depend on what's installed on the server. Some of the kernels in the screenshot below may not exist as an option to you.\n",
93 "\n",
93 "\n",
94 "<img src=\"images/dashboard_files_tab_new.png\" width=\"202px\" />"
94 "<img src=\"images/dashboard_files_tab_new.png\" width=\"202px\" />"
95 ]
95 ]
96 },
96 },
97 {
97 {
98 "cell_type": "markdown",
98 "cell_type": "markdown",
99 "metadata": {},
99 "metadata": {},
100 "source": [
100 "source": [
101 "Notebooks and files can be uploaded to the current directory by dragging a notebook file onto the notebook list or by the \"click here\" text above the list.\n",
101 "Notebooks and files can be uploaded to the current directory by dragging a notebook file onto the notebook list or by the \"click here\" text above the list.\n",
102 "\n",
102 "\n",
103 "The notebook list shows green \"Running\" text and a green notebook icon next to running notebooks (as seen below). Notebooks remain running until you explicitly shut them down; closing the notebook's page is not sufficient.\n",
103 "The notebook list shows green \"Running\" text and a green notebook icon next to running notebooks (as seen below). Notebooks remain running until you explicitly shut them down; closing the notebook's page is not sufficient.\n",
104 "\n",
104 "\n",
105 "<img src=\"images/dashboard_files_tab_run.png\" width=\"777px\"/>"
105 "<img src=\"images/dashboard_files_tab_run.png\" width=\"777px\"/>"
106 ]
106 ]
107 },
107 },
108 {
108 {
109 "cell_type": "markdown",
109 "cell_type": "markdown",
110 "metadata": {},
110 "metadata": {},
111 "source": [
111 "source": [
112 "To shutdown, delete, duplicate, or rename a notebook check the checkbox next to it and an array of controls will appear at the top of the notebook list (as seen below). You can also use the same operations on directories and files when applicable.\n",
112 "To shutdown, delete, duplicate, or rename a notebook check the checkbox next to it and an array of controls will appear at the top of the notebook list (as seen below). You can also use the same operations on directories and files when applicable.\n",
113 "\n",
113 "\n",
114 "<img src=\"images/dashboard_files_tab_btns.png\" width=\"301px\" />"
114 "<img src=\"images/dashboard_files_tab_btns.png\" width=\"301px\" />"
115 ]
115 ]
116 },
116 },
117 {
117 {
118 "cell_type": "markdown",
118 "cell_type": "markdown",
119 "metadata": {},
119 "metadata": {},
120 "source": [
120 "source": [
121 "To see all of your running notebooks along with their directories, click on the \"Running\" tab:\n",
121 "To see all of your running notebooks along with their directories, click on the \"Running\" tab:\n",
122 "\n",
122 "\n",
123 "<img src=\"images/dashboard_running_tab.png\" width=\"786px\" />\n",
123 "<img src=\"images/dashboard_running_tab.png\" width=\"786px\" />\n",
124 "\n",
124 "\n",
125 "This view provides a convenient way to track notebooks that you start as you navigate the file system in a long running notebook server."
125 "This view provides a convenient way to track notebooks that you start as you navigate the file system in a long running notebook server."
126 ]
126 ]
127 },
127 },
128 {
128 {
129 "cell_type": "markdown",
129 "cell_type": "markdown",
130 "metadata": {},
130 "metadata": {},
131 "source": [
131 "source": [
132 "## Overview of the Notebook UI"
132 "## Overview of the Notebook UI"
133 ]
133 ]
134 },
134 },
135 {
135 {
136 "cell_type": "markdown",
136 "cell_type": "markdown",
137 "metadata": {},
137 "metadata": {},
138 "source": [
138 "source": [
139 "If you create a new notebook or open an existing one, you will be taken to the notebook user interface (UI). This UI allows you to run code and author notebook documents interactively. The notebook UI has the following main areas:\n",
139 "If you create a new notebook or open an existing one, you will be taken to the notebook user interface (UI). This UI allows you to run code and author notebook documents interactively. The notebook UI has the following main areas:\n",
140 "\n",
140 "\n",
141 "* Menu\n",
141 "* Menu\n",
142 "* Toolbar\n",
142 "* Toolbar\n",
143 "* Notebook area and cells\n",
143 "* Notebook area and cells\n",
144 "\n",
144 "\n",
145 "The notebook has an interactive tour of these elements that can be started in the \"Help:User Interface Tour\" menu item."
145 "The notebook has an interactive tour of these elements that can be started in the \"Help:User Interface Tour\" menu item."
146 ]
146 ]
147 },
147 },
148 {
148 {
149 "cell_type": "markdown",
149 "cell_type": "markdown",
150 "metadata": {},
150 "metadata": {},
151 "source": [
151 "source": [
152 "## Modal editor"
152 "## Modal editor"
153 ]
153 ]
154 },
154 },
155 {
155 {
156 "cell_type": "markdown",
156 "cell_type": "markdown",
157 "metadata": {},
157 "metadata": {},
158 "source": [
158 "source": [
159 "Starting with IPython 2.0, the IPython Notebook has a modal user interface. This means that the keyboard does different things depending on which mode the Notebook is in. There are two modes: edit mode and command mode."
159 "Starting with IPython 2.0, the IPython Notebook has a modal user interface. This means that the keyboard does different things depending on which mode the Notebook is in. There are two modes: edit mode and command mode."
160 ]
160 ]
161 },
161 },
162 {
162 {
163 "cell_type": "markdown",
163 "cell_type": "markdown",
164 "metadata": {},
164 "metadata": {},
165 "source": [
165 "source": [
166 "### Edit mode"
166 "### Edit mode"
167 ]
167 ]
168 },
168 },
169 {
169 {
170 "cell_type": "markdown",
170 "cell_type": "markdown",
171 "metadata": {},
171 "metadata": {},
172 "source": [
172 "source": [
173 "Edit mode is indicated by a green cell border and a prompt showing in the editor area:\n",
173 "Edit mode is indicated by a green cell border and a prompt showing in the editor area:\n",
174 "\n",
174 "\n",
175 "<img src=\"images/edit_mode.png\">\n",
175 "<img src=\"images/edit_mode.png\">\n",
176 "\n",
176 "\n",
177 "When a cell is in edit mode, you can type into the cell, like a normal text editor."
177 "When a cell is in edit mode, you can type into the cell, like a normal text editor."
178 ]
178 ]
179 },
179 },
180 {
180 {
181 "cell_type": "markdown",
181 "cell_type": "markdown",
182 "metadata": {},
182 "metadata": {},
183 "source": [
183 "source": [
184 "<div class=\"alert alert-success\">\n",
184 "<div class=\"alert alert-success\">\n",
185 "Enter edit mode by pressing `Enter` or using the mouse to click on a cell's editor area.\n",
185 "Enter edit mode by pressing `Enter` or using the mouse to click on a cell's editor area.\n",
186 "</div>"
186 "</div>"
187 ]
187 ]
188 },
188 },
189 {
189 {
190 "cell_type": "markdown",
190 "cell_type": "markdown",
191 "metadata": {},
191 "metadata": {},
192 "source": [
192 "source": [
193 "### Command mode"
193 "### Command mode"
194 ]
194 ]
195 },
195 },
196 {
196 {
197 "cell_type": "markdown",
197 "cell_type": "markdown",
198 "metadata": {},
198 "metadata": {},
199 "source": [
199 "source": [
200 "Command mode is indicated by a grey cell border:\n",
200 "Command mode is indicated by a grey cell border:\n",
201 "\n",
201 "\n",
202 "<img src=\"images/command_mode.png\">\n",
202 "<img src=\"images/command_mode.png\">\n",
203 "\n",
203 "\n",
204 "When you are in command mode, you are able to edit the notebook as a whole, but not type into individual cells. Most importantly, in command mode, the keyboard is mapped to a set of shortcuts that let you perform notebook and cell actions efficiently. For example, if you are in command mode and you press `c`, you will copy the current cell - no modifier is needed."
204 "When you are in command mode, you are able to edit the notebook as a whole, but not type into individual cells. Most importantly, in command mode, the keyboard is mapped to a set of shortcuts that let you perform notebook and cell actions efficiently. For example, if you are in command mode and you press `c`, you will copy the current cell - no modifier is needed."
205 ]
205 ]
206 },
206 },
207 {
207 {
208 "cell_type": "markdown",
208 "cell_type": "markdown",
209 "metadata": {},
209 "metadata": {},
210 "source": [
210 "source": [
211 "<div class=\"alert alert-error\">\n",
211 "<div class=\"alert alert-error\">\n",
212 "Don't try to type into a cell in command mode; unexpected things will happen!\n",
212 "Don't try to type into a cell in command mode; unexpected things will happen!\n",
213 "</div>"
213 "</div>"
214 ]
214 ]
215 },
215 },
216 {
216 {
217 "cell_type": "markdown",
217 "cell_type": "markdown",
218 "metadata": {},
218 "metadata": {},
219 "source": [
219 "source": [
220 "<div class=\"alert alert-success\">\n",
220 "<div class=\"alert alert-success\">\n",
221 "Enter command mode by pressing `Esc` or using the mouse to click *outside* a cell's editor area.\n",
221 "Enter command mode by pressing `Esc` or using the mouse to click *outside* a cell's editor area.\n",
222 "</div>"
222 "</div>"
223 ]
223 ]
224 },
224 },
225 {
225 {
226 "cell_type": "markdown",
226 "cell_type": "markdown",
227 "metadata": {},
227 "metadata": {},
228 "source": [
228 "source": [
229 "## Mouse navigation"
229 "## Mouse navigation"
230 ]
230 ]
231 },
231 },
232 {
232 {
233 "cell_type": "markdown",
233 "cell_type": "markdown",
234 "metadata": {},
234 "metadata": {},
235 "source": [
235 "source": [
236 "All navigation and actions in the Notebook are available using the mouse through the menubar and toolbar, which are both above the main Notebook area:\n",
236 "All navigation and actions in the Notebook are available using the mouse through the menubar and toolbar, which are both above the main Notebook area:\n",
237 "\n",
237 "\n",
238 "<img src=\"images/menubar_toolbar.png\" width=\"786px\" />"
238 "<img src=\"images/menubar_toolbar.png\" width=\"786px\" />"
239 ]
239 ]
240 },
240 },
241 {
241 {
242 "cell_type": "markdown",
242 "cell_type": "markdown",
243 "metadata": {},
243 "metadata": {},
244 "source": [
244 "source": [
245 "The first idea of mouse based navigation is that **cells can be selected by clicking on them.** The currently selected cell gets a grey or green border depending on whether the notebook is in edit or command mode. If you click inside a cell's editor area, you will enter edit mode. If you click on the prompt or output area of a cell you will enter command mode.\n",
245 "The first idea of mouse based navigation is that **cells can be selected by clicking on them.** The currently selected cell gets a grey or green border depending on whether the notebook is in edit or command mode. If you click inside a cell's editor area, you will enter edit mode. If you click on the prompt or output area of a cell you will enter command mode.\n",
246 "\n",
246 "\n",
247 "If you are running this notebook in a live session (not on http://nbviewer.ipython.org) try selecting different cells and going between edit and command mode. Try typing into a cell."
247 "If you are running this notebook in a live session (not on http://nbviewer.ipython.org) try selecting different cells and going between edit and command mode. Try typing into a cell."
248 ]
248 ]
249 },
249 },
250 {
250 {
251 "cell_type": "markdown",
251 "cell_type": "markdown",
252 "metadata": {},
252 "metadata": {},
253 "source": [
253 "source": [
254 "The second idea of mouse based navigation is that **cell actions usually apply to the currently selected cell**. Thus if you want to run the code in a cell, you would select it and click the <button class='btn btn-default btn-xs'><i class=\"fa fa-play icon-play\"></i></button> button in the toolbar or the \"Cell:Run\" menu item. Similarly, to copy a cell you would select it and click the <button class='btn btn-default btn-xs'><i class=\"fa fa-copy icon-copy\"></i></button> button in the toolbar or the \"Edit:Copy\" menu item. With this simple pattern, you should be able to do most everything you need with the mouse.\n",
254 "The second idea of mouse based navigation is that **cell actions usually apply to the currently selected cell**. Thus if you want to run the code in a cell, you would select it and click the <button class='btn btn-default btn-xs'><i class=\"fa fa-play icon-play\"></i></button> button in the toolbar or the \"Cell:Run\" menu item. Similarly, to copy a cell you would select it and click the <button class='btn btn-default btn-xs'><i class=\"fa fa-copy icon-copy\"></i></button> button in the toolbar or the \"Edit:Copy\" menu item. With this simple pattern, you should be able to do most everything you need with the mouse.\n",
255 "\n",
255 "\n",
256 "Markdown and heading cells have one other state that can be modified with the mouse. These cells can either be rendered or unrendered. When they are rendered, you will see a nice formatted representation of the cell's contents. When they are unrendered, you will see the raw text source of the cell. To render the selected cell with the mouse, click the <button class='btn btn-default btn-xs'><i class=\"fa fa-play icon-play\"></i></button> button in the toolbar or the \"Cell:Run\" menu item. To unrender the selected cell, double click on the cell."
256 "Markdown and heading cells have one other state that can be modified with the mouse. These cells can either be rendered or unrendered. When they are rendered, you will see a nice formatted representation of the cell's contents. When they are unrendered, you will see the raw text source of the cell. To render the selected cell with the mouse, click the <button class='btn btn-default btn-xs'><i class=\"fa fa-play icon-play\"></i></button> button in the toolbar or the \"Cell:Run\" menu item. To unrender the selected cell, double click on the cell."
257 ]
257 ]
258 },
258 },
259 {
259 {
260 "cell_type": "markdown",
260 "cell_type": "markdown",
261 "metadata": {},
261 "metadata": {},
262 "source": [
262 "source": [
263 "## Keyboard Navigation"
263 "## Keyboard Navigation"
264 ]
264 ]
265 },
265 },
266 {
266 {
267 "cell_type": "markdown",
267 "cell_type": "markdown",
268 "metadata": {},
268 "metadata": {},
269 "source": [
269 "source": [
270 "The modal user interface of the IPython Notebook has been optimized for efficient keyboard usage. This is made possible by having two different sets of keyboard shortcuts: one set that is active in edit mode and another in command mode.\n",
270 "The modal user interface of the IPython Notebook has been optimized for efficient keyboard usage. This is made possible by having two different sets of keyboard shortcuts: one set that is active in edit mode and another in command mode.\n",
271 "\n",
271 "\n",
272 "The most important keyboard shortcuts are `Enter`, which enters edit mode, and `Esc`, which enters command mode.\n",
272 "The most important keyboard shortcuts are `Enter`, which enters edit mode, and `Esc`, which enters command mode.\n",
273 "\n",
273 "\n",
274 "In edit mode, most of the keyboard is dedicated to typing into the cell's editor. Thus, in edit mode there are relatively few shortcuts. In command mode, the entire keyboard is available for shortcuts, so there are many more. The `Help`->`Keyboard Shortcuts` dialog lists the available shortcuts."
274 "In edit mode, most of the keyboard is dedicated to typing into the cell's editor. Thus, in edit mode there are relatively few shortcuts. In command mode, the entire keyboard is available for shortcuts, so there are many more. The `Help`->`Keyboard Shortcuts` dialog lists the available shortcuts."
275 ]
275 ]
276 },
276 },
277 {
277 {
278 "cell_type": "markdown",
278 "cell_type": "markdown",
279 "metadata": {},
279 "metadata": {},
280 "source": [
280 "source": [
281 "We recommend learning the command mode shortcuts in the following rough order:\n",
281 "We recommend learning the command mode shortcuts in the following rough order:\n",
282 "\n",
282 "\n",
283 "1. Basic navigation: `enter`, `shift-enter`, `up/k`, `down/j`\n",
283 "1. Basic navigation: `enter`, `shift-enter`, `up/k`, `down/j`\n",
284 "2. Saving the notebook: `s`\n",
284 "2. Saving the notebook: `s`\n",
285 "2. Cell types: `y`, `m`, `1-6`, `t`\n",
285 "2. Cell types: `y`, `m`, `1-6`, `t`\n",
286 "3. Cell creation: `a`, `b`\n",
286 "3. Cell creation: `a`, `b`\n",
287 "4. Cell editing: `x`, `c`, `v`, `d`, `z`, `shift+=`\n",
287 "4. Cell editing: `x`, `c`, `v`, `d`, `z`, `shift+=`\n",
288 "5. Kernel operations: `i`, `.`"
288 "5. Kernel operations: `i`, `.`"
289 ]
289 ]
290 }
290 }
291 ],
291 ],
292 "metadata": {
292 "metadata": {
293 "kernelspec": {
293 "kernelspec": {
294 "display_name": "Python 3",
294 "display_name": "Python 3",
295 "language": "python",
295 "language": "python",
296 "name": "python3"
296 "name": "python3"
297 },
297 },
298 "language_info": {
298 "language_info": {
299 "codemirror_mode": {
299 "codemirror_mode": {
300 "name": "ipython",
300 "name": "ipython",
301 "version": 3
301 "version": 3
302 },
302 },
303 "file_extension": ".py",
303 "file_extension": ".py",
304 "mimetype": "text/x-python",
304 "mimetype": "text/x-python",
305 "name": "python",
305 "name": "python",
306 "nbconvert_exporter": "python",
306 "nbconvert_exporter": "python",
307 "pygments_lexer": "ipython3",
307 "pygments_lexer": "ipython3",
308 "version": "3.4.3"
308 "version": "3.4.3"
309 }
309 }
310 },
310 },
311 "nbformat": 4,
311 "nbformat": 4,
312 "nbformat_minor": 0
312 "nbformat_minor": 0
313 }
313 }
General Comments 0
You need to be logged in to leave comments. Login now