##// END OF EJS Templates
Merge pull request #7374 from juhasch/fix_example...
Min RK -
r19805:1b262f4d merge
parent child Browse files
Show More
@@ -1,302 +1,302 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 "# Markdown Cells"
7 "# Markdown Cells"
8 ]
8 ]
9 },
9 },
10 {
10 {
11 "cell_type": "markdown",
11 "cell_type": "markdown",
12 "metadata": {},
12 "metadata": {},
13 "source": [
13 "source": [
14 "Text can be added to IPython Notebooks using Markdown cells. Markdown is a popular markup language that is a superset of HTML. Its specification can be found here:\n",
14 "Text can be added to IPython Notebooks using Markdown cells. Markdown is a popular markup language that is a superset of HTML. Its specification can be found here:\n",
15 "\n",
15 "\n",
16 "<http://daringfireball.net/projects/markdown/>"
16 "<http://daringfireball.net/projects/markdown/>"
17 ]
17 ]
18 },
18 },
19 {
19 {
20 "cell_type": "markdown",
20 "cell_type": "markdown",
21 "metadata": {},
21 "metadata": {},
22 "source": [
22 "source": [
23 "## Markdown basics"
23 "## Markdown basics"
24 ]
24 ]
25 },
25 },
26 {
26 {
27 "cell_type": "markdown",
27 "cell_type": "markdown",
28 "metadata": {},
28 "metadata": {},
29 "source": [
29 "source": [
30 "You can make text *italic* or **bold**."
30 "You can make text *italic* or **bold**."
31 ]
31 ]
32 },
32 },
33 {
33 {
34 "cell_type": "markdown",
34 "cell_type": "markdown",
35 "metadata": {},
35 "metadata": {},
36 "source": [
36 "source": [
37 "You can build nested itemized or enumerated lists:\n",
37 "You can build nested itemized or enumerated lists:\n",
38 "\n",
38 "\n",
39 "* One\n",
39 "* One\n",
40 " - Sublist\n",
40 " - Sublist\n",
41 " - This\n",
41 " - This\n",
42 " - Sublist\n",
42 " - Sublist\n",
43 " - That\n",
43 " - That\n",
44 " - The other thing\n",
44 " - The other thing\n",
45 "* Two\n",
45 "* Two\n",
46 " - Sublist\n",
46 " - Sublist\n",
47 "* Three\n",
47 "* Three\n",
48 " - Sublist\n",
48 " - Sublist\n",
49 "\n",
49 "\n",
50 "Now another list:\n",
50 "Now another list:\n",
51 "\n",
51 "\n",
52 "1. Here we go\n",
52 "1. Here we go\n",
53 " 1. Sublist\n",
53 " 1. Sublist\n",
54 " 2. Sublist\n",
54 " 2. Sublist\n",
55 "2. There we go\n",
55 "2. There we go\n",
56 "3. Now this"
56 "3. Now this"
57 ]
57 ]
58 },
58 },
59 {
59 {
60 "cell_type": "markdown",
60 "cell_type": "markdown",
61 "metadata": {},
61 "metadata": {},
62 "source": [
62 "source": [
63 "You can add horizontal rules:\n",
63 "You can add horizontal rules:\n",
64 "\n",
64 "\n",
65 "---"
65 "---"
66 ]
66 ]
67 },
67 },
68 {
68 {
69 "cell_type": "markdown",
69 "cell_type": "markdown",
70 "metadata": {},
70 "metadata": {},
71 "source": [
71 "source": [
72 "Here is a blockquote:\n",
72 "Here is a blockquote:\n",
73 "\n",
73 "\n",
74 "> Beautiful is better than ugly.\n",
74 "> Beautiful is better than ugly.\n",
75 "> Explicit is better than implicit.\n",
75 "> Explicit is better than implicit.\n",
76 "> Simple is better than complex.\n",
76 "> Simple is better than complex.\n",
77 "> Complex is better than complicated.\n",
77 "> Complex is better than complicated.\n",
78 "> Flat is better than nested.\n",
78 "> Flat is better than nested.\n",
79 "> Sparse is better than dense.\n",
79 "> Sparse is better than dense.\n",
80 "> Readability counts.\n",
80 "> Readability counts.\n",
81 "> Special cases aren't special enough to break the rules.\n",
81 "> Special cases aren't special enough to break the rules.\n",
82 "> Although practicality beats purity.\n",
82 "> Although practicality beats purity.\n",
83 "> Errors should never pass silently.\n",
83 "> Errors should never pass silently.\n",
84 "> Unless explicitly silenced.\n",
84 "> Unless explicitly silenced.\n",
85 "> In the face of ambiguity, refuse the temptation to guess.\n",
85 "> In the face of ambiguity, refuse the temptation to guess.\n",
86 "> There should be one-- and preferably only one --obvious way to do it.\n",
86 "> There should be one-- and preferably only one --obvious way to do it.\n",
87 "> Although that way may not be obvious at first unless you're Dutch.\n",
87 "> Although that way may not be obvious at first unless you're Dutch.\n",
88 "> Now is better than never.\n",
88 "> Now is better than never.\n",
89 "> Although never is often better than *right* now.\n",
89 "> Although never is often better than *right* now.\n",
90 "> If the implementation is hard to explain, it's a bad idea.\n",
90 "> If the implementation is hard to explain, it's a bad idea.\n",
91 "> If the implementation is easy to explain, it may be a good idea.\n",
91 "> If the implementation is easy to explain, it may be a good idea.\n",
92 "> Namespaces are one honking great idea -- let's do more of those!"
92 "> Namespaces are one honking great idea -- let's do more of those!"
93 ]
93 ]
94 },
94 },
95 {
95 {
96 "cell_type": "markdown",
96 "cell_type": "markdown",
97 "metadata": {},
97 "metadata": {},
98 "source": [
98 "source": [
99 "And shorthand for links:\n",
99 "And shorthand for links:\n",
100 "\n",
100 "\n",
101 "[IPython's website](http://ipython.org)"
101 "[IPython's website](http://ipython.org)"
102 ]
102 ]
103 },
103 },
104 {
104 {
105 "cell_type": "markdown",
105 "cell_type": "markdown",
106 "metadata": {},
106 "metadata": {},
107 "source": [
107 "source": [
108 "## Headings"
108 "## Headings"
109 ]
109 ]
110 },
110 },
111 {
111 {
112 "cell_type": "markdown",
112 "cell_type": "markdown",
113 "metadata": {},
113 "metadata": {},
114 "source": [
114 "source": [
115 "If you want, you can add headings using Markdown's syntax:\n",
115 "If you want, you can add headings using Markdown's syntax:\n",
116 "\n",
116 "\n",
117 "# Heading 1\n",
117 "# Heading 1\n",
118 "# Heading 2\n",
118 "# Heading 2\n",
119 "## Heading 2.1\n",
119 "## Heading 2.1\n",
120 "## Heading 2.2"
120 "## Heading 2.2"
121 ]
121 ]
122 },
122 },
123 {
123 {
124 "cell_type": "markdown",
124 "cell_type": "markdown",
125 "metadata": {},
125 "metadata": {},
126 "source": [
126 "source": [
127 "**BUT most of the time you should use the Notebook's Heading Cells to organize your Notebook content**, as they provide meaningful structure that can be interpreted by other tools, not just large bold fonts."
127 "**BUT most of the time you should use the Notebook's Heading Cells to organize your Notebook content**, as they provide meaningful structure that can be interpreted by other tools, not just large bold fonts."
128 ]
128 ]
129 },
129 },
130 {
130 {
131 "cell_type": "markdown",
131 "cell_type": "markdown",
132 "metadata": {},
132 "metadata": {},
133 "source": [
133 "source": [
134 "## Embedded code"
134 "## Embedded code"
135 ]
135 ]
136 },
136 },
137 {
137 {
138 "cell_type": "markdown",
138 "cell_type": "markdown",
139 "metadata": {},
139 "metadata": {},
140 "source": [
140 "source": [
141 "You can embed code meant for illustration instead of execution in Python:\n",
141 "You can embed code meant for illustration instead of execution in Python:\n",
142 "\n",
142 "\n",
143 " def f(x):\n",
143 " def f(x):\n",
144 " \"\"\"a docstring\"\"\"\n",
144 " \"\"\"a docstring\"\"\"\n",
145 " return x**2\n",
145 " return x**2\n",
146 "\n",
146 "\n",
147 "or other languages:\n",
147 "or other languages:\n",
148 "\n",
148 "\n",
149 " if (i=0; i<n; i++) {\n",
149 " if (i=0; i<n; i++) {\n",
150 " printf(\"hello %d\\n\", i);\n",
150 " printf(\"hello %d\\n\", i);\n",
151 " x += 4;\n",
151 " x += 4;\n",
152 " }"
152 " }"
153 ]
153 ]
154 },
154 },
155 {
155 {
156 "cell_type": "markdown",
156 "cell_type": "markdown",
157 "metadata": {},
157 "metadata": {},
158 "source": [
158 "source": [
159 "## LaTeX equations"
159 "## LaTeX equations"
160 ]
160 ]
161 },
161 },
162 {
162 {
163 "cell_type": "markdown",
163 "cell_type": "markdown",
164 "metadata": {},
164 "metadata": {},
165 "source": [
165 "source": [
166 "Courtesy of MathJax, you can include mathematical expressions both inline: \n",
166 "Courtesy of MathJax, you can include mathematical expressions both inline: \n",
167 "$e^{i\\pi} + 1 = 0$ and displayed:\n",
167 "$e^{i\\pi} + 1 = 0$ and displayed:\n",
168 "\n",
168 "\n",
169 "$$e^x=\\sum_{i=0}^\\infty \\frac{1}{i!}x^i$$"
169 "$$e^x=\\sum_{i=0}^\\infty \\frac{1}{i!}x^i$$"
170 ]
170 ]
171 },
171 },
172 {
172 {
173 "cell_type": "markdown",
173 "cell_type": "markdown",
174 "metadata": {},
174 "metadata": {},
175 "source": [
175 "source": [
176 "## Github flavored markdown (GFM)"
176 "## Github flavored markdown (GFM)"
177 ]
177 ]
178 },
178 },
179 {
179 {
180 "cell_type": "markdown",
180 "cell_type": "markdown",
181 "metadata": {},
181 "metadata": {},
182 "source": [
182 "source": [
183 "The Notebook webapp support Github flavored markdown meaning that you can use triple backticks for code blocks \n",
183 "The Notebook webapp support Github flavored markdown meaning that you can use triple backticks for code blocks \n",
184 "<pre>\n",
184 "<pre>\n",
185 "```python\n",
185 "```python\n",
186 "print \"Hello World\"\n",
186 "print \"Hello World\"\n",
187 "```\n",
187 "```\n",
188 "\n",
188 "\n",
189 "```javascript\n",
189 "```javascript\n",
190 "console.log(\"Hello World\")\n",
190 "console.log(\"Hello World\")\n",
191 "```\n",
191 "```\n",
192 "</pre>\n",
192 "</pre>\n",
193 "\n",
193 "\n",
194 "Gives \n",
194 "Gives \n",
195 "```python\n",
195 "```python\n",
196 "print \"Hello World\"\n",
196 "print \"Hello World\"\n",
197 "```\n",
197 "```\n",
198 "\n",
198 "\n",
199 "```javascript\n",
199 "```javascript\n",
200 "console.log(\"Hello World\")\n",
200 "console.log(\"Hello World\")\n",
201 "```\n",
201 "```\n",
202 "\n",
202 "\n",
203 "And a table like this : \n",
203 "And a table like this : \n",
204 "\n",
204 "\n",
205 "<pre>\n",
205 "<pre>\n",
206 "| This | is |\n",
206 "| This | is |\n",
207 "|------|------|\n",
207 "|------|------|\n",
208 "| a | table| \n",
208 "| a | table| \n",
209 "</pre>\n",
209 "</pre>\n",
210 "\n",
210 "\n",
211 "A nice Html Table\n",
211 "A nice Html Table\n",
212 "\n",
212 "\n",
213 "| This | is |\n",
213 "| This | is |\n",
214 "|------|------|\n",
214 "|------|------|\n",
215 "| a | table| "
215 "| a | table| "
216 ]
216 ]
217 },
217 },
218 {
218 {
219 "cell_type": "markdown",
219 "cell_type": "markdown",
220 "metadata": {},
220 "metadata": {},
221 "source": [
221 "source": [
222 "## General HTML"
222 "## General HTML"
223 ]
223 ]
224 },
224 },
225 {
225 {
226 "cell_type": "markdown",
226 "cell_type": "markdown",
227 "metadata": {},
227 "metadata": {},
228 "source": [
228 "source": [
229 "Because Markdown is a superset of HTML you can even add things like HTML tables:\n",
229 "Because Markdown is a superset of HTML you can even add things like HTML tables:\n",
230 "\n",
230 "\n",
231 "<table>\n",
231 "<table>\n",
232 "<tr>\n",
232 "<tr>\n",
233 "<th>Header 1</th>\n",
233 "<th>Header 1</th>\n",
234 "<th>Header 2</th>\n",
234 "<th>Header 2</th>\n",
235 "</tr>\n",
235 "</tr>\n",
236 "<tr>\n",
236 "<tr>\n",
237 "<td>row 1, cell 1</td>\n",
237 "<td>row 1, cell 1</td>\n",
238 "<td>row 1, cell 2</td>\n",
238 "<td>row 1, cell 2</td>\n",
239 "</tr>\n",
239 "</tr>\n",
240 "<tr>\n",
240 "<tr>\n",
241 "<td>row 2, cell 1</td>\n",
241 "<td>row 2, cell 1</td>\n",
242 "<td>row 2, cell 2</td>\n",
242 "<td>row 2, cell 2</td>\n",
243 "</tr>\n",
243 "</tr>\n",
244 "</table>"
244 "</table>"
245 ]
245 ]
246 },
246 },
247 {
247 {
248 "cell_type": "markdown",
248 "cell_type": "markdown",
249 "metadata": {},
249 "metadata": {},
250 "source": [
250 "source": [
251 "## Local files"
251 "## Local files"
252 ]
252 ]
253 },
253 },
254 {
254 {
255 "cell_type": "markdown",
255 "cell_type": "markdown",
256 "metadata": {},
256 "metadata": {},
257 "source": [
257 "source": [
258 "If you have local files in your Notebook directory, you can refer to these files in Markdown cells directly:\n",
258 "If you have local files in your Notebook directory, you can refer to these files in Markdown cells directly:\n",
259 "\n",
259 "\n",
260 " [subdirectory/]<filename>\n",
260 " [subdirectory/]<filename>\n",
261 "\n",
261 "\n",
262 "For example, in the images folder, we have the Python logo:\n",
262 "For example, in the images folder, we have the Python logo:\n",
263 "\n",
263 "\n",
264 " <img src=\"images/python-logo.svg\" />\n",
264 " <img src=\"../images/python_logo.svg\" />\n",
265 "\n",
265 "\n",
266 "<img src=\"images/python-logo.svg\" />\n",
266 "<img src=\"../images/python_logo.svg\" />\n",
267 "\n",
267 "\n",
268 "and a video with the HTML5 video tag:\n",
268 "and a video with the HTML5 video tag:\n",
269 "\n",
269 "\n",
270 " <video controls src=\"images/animation.m4v\" />\n",
270 " <video controls src=\"images/animation.m4v\" />\n",
271 "\n",
271 "\n",
272 "<video controls src=\"images/animation.m4v\" />\n",
272 "<video controls src=\"images/animation.m4v\" />\n",
273 "\n",
273 "\n",
274 "These do not embed the data into the notebook file, and require that the files exist when you are viewing the notebook."
274 "These do not embed the data into the notebook file, and require that the files exist when you are viewing the notebook."
275 ]
275 ]
276 },
276 },
277 {
277 {
278 "cell_type": "markdown",
278 "cell_type": "markdown",
279 "metadata": {},
279 "metadata": {},
280 "source": [
280 "source": [
281 "### Security of local files"
281 "### Security of local files"
282 ]
282 ]
283 },
283 },
284 {
284 {
285 "cell_type": "markdown",
285 "cell_type": "markdown",
286 "metadata": {},
286 "metadata": {},
287 "source": [
287 "source": [
288 "Note that this means that the IPython notebook server also acts as a generic file server\n",
288 "Note that this means that the IPython notebook server also acts as a generic file server\n",
289 "for files inside the same tree as your notebooks. Access is not granted outside the\n",
289 "for files inside the same tree as your notebooks. Access is not granted outside the\n",
290 "notebook folder so you have strict control over what files are visible, but for this\n",
290 "notebook folder so you have strict control over what files are visible, but for this\n",
291 "reason it is highly recommended that you do not run the notebook server with a notebook\n",
291 "reason it is highly recommended that you do not run the notebook server with a notebook\n",
292 "directory at a high level in your filesystem (e.g. your home directory).\n",
292 "directory at a high level in your filesystem (e.g. your home directory).\n",
293 "\n",
293 "\n",
294 "When you run the notebook in a password-protected manner, local file access is restricted\n",
294 "When you run the notebook in a password-protected manner, local file access is restricted\n",
295 "to authenticated users unless read-only views are active."
295 "to authenticated users unless read-only views are active."
296 ]
296 ]
297 }
297 }
298 ],
298 ],
299 "metadata": {},
299 "metadata": {},
300 "nbformat": 4,
300 "nbformat": 4,
301 "nbformat_minor": 0
301 "nbformat_minor": 0
302 } No newline at end of file
302 }
General Comments 0
You need to be logged in to leave comments. Login now