Scripting Python – Jupyter Markdown

Markdown Cells

Text can be added to Jupyter Notebooks using Markdown cells. You can change the cell type to Markdown by using the Cell menu, the toolbar, or the key shortcut m. Markdown is a popular markup language that is a superset of HTML. Its specification can be found here:

https://daringfireball.net/projects/markdown/

Markdown basics

You can make text italic or bold by surrounding a block of text with a single or double * respectively.

You can make text *italic* or **bold** by surrounding a block of text with a single or double * respectively.

You can build nested itemized or enumerated lists:

  • One
    • Sublist
      • This
        • Sublist
      • That
      • The other thing
  • Two
    • Sublist
  • Three
    • Sublist

Now another list:

  1. Here we go
    1. Sublist
    2. Sublist
  2. There we go
  3. Now this
You can build nested itemized or enumerated lists:

* One
    - Sublist
        - This
  - Sublist
        - That
        - The other thing
* Two
  - Sublist
* Three
  - Sublist

Now another list:

1. Here we go
    1. Sublist
    2. Sublist
2. There we go
3. Now this

You can add horizontal rules:


You can add horizontal rules:
---

Here is a blockquote:

Beautiful is better than ugly. Explicit is better than implicit. Simple is better than complex. Complex is better than complicated. Flat is better than nested. Sparse is better than dense. Readability counts. Special cases aren’t special enough to break the rules. Although practicality beats purity. Errors should never pass silently. Unless explicitly silenced. In the face of ambiguity, refuse the temptation to guess. There should be one– and preferably only one –obvious way to do it. Although that way may not be obvious at first unless you’re Dutch. Now is better than never. Although never is often better than right now. If the implementation is hard to explain, it’s a bad idea. If the implementation is easy to explain, it may be a good idea. Namespaces are one honking great idea — let’s do more of those!

Here is a blockquote:

> Beautiful is better than ugly.
> Explicit is better than implicit.
> Simple is better than complex.
> Complex is better than complicated.
> Flat is better than nested.
> Sparse is better than dense.
> Readability counts.
> Special cases aren't special enough to break the rules.
> Although practicality beats purity.
> Errors should never pass silently.
> Unless explicitly silenced.
> In the face of ambiguity, refuse the temptation to guess.
> There should be one-- and preferably only one --obvious way to do it.
> Although that way may not be obvious at first unless you're Dutch.
> Now is better than never.
> Although never is often better than *right* now.
> If the implementation is hard to explain, it's a bad idea.
> If the implementation is easy to explain, it may be a good idea.
> Namespaces are one honking great idea -- let's do more of those!

And shorthand for links:

Jupyter’s website

And shorthand for links:

[Jupyter's website](https://jupyter.org)

You can use backslash \ to generate literal characters which would otherwise have special meaning in the Markdown syntax.

*literal asterisks*
\*literal asterisks\*

Headings

You can add headings by starting a line with one (or multiple) # followed by a space, as in the following example:

Heading 1

Heading 2

Heading 2.1

Heading 2.2

# Heading 1
# Heading 2
## Heading 2.1
## Heading 2.2

Embedded code

You can embed code meant for illustration instead of execution in Python:

def f(x):
    """a docstring"""
    return x**2
```
def f(x):
    """a docstring"""
    return x**2
```

With syntax highlighting (by specyfying the language used) :

def f(x):
    """a docstring"""
    return x**2
```python
def f(x):
    """a docstring"""
    return x**2
```

or other languages:

if (i=0; i<n; i++) {
  printf("hello %d\n", i);
  x += 4;
}
```
if (i=0; i<n; i++) {
  printf("hello %d\n", i);
  x += 4;
}
```

Adding a HTML table

| This | is   |
|------|------|
|   a  | table|
<table>
<tr>
<th>Header 1</th>
<th>Header 2</th>
</tr>
<tr>
<td>row 1, cell 1</td>
<td>row 1, cell 2</td>
</tr>
<tr>
<td>row 2, cell 1</td>
<td>row 2, cell 2</td>
</tr>
</table>

Local files

<img src="img/filename" />
<audio controls src="audio/filename" />
<video width="640" height="480" controls src="video/filename" />

Fermer le menu