Atx-style headers

Heading level 1

Heading level 2

Heading level 3

Heading level 4

Heading level 5

Heading level 1

Heading level 2

Heading level 3

Heading level 4

Heading level 5

Setext-style headers

Heading level 1

Heading level 2

Multiple headers in one cell

Heading level 1

Heading level 2

Heading level 3

Heading level 4

Heading level 5

Bold, italic, or both using asterisks

Bold, italic, or both using underscores

Strikethrough text

Pipe tables

Right Left Default Center
12 12 12 12
123 123 123 123
1 1 1 1

List using asterisks

  • one
  • two
    • two-one
    • two-two
      • two-two-one
      • two-two-two
        • two-two-two-one
        • two-two-two-two
          • two-two-two-two-one
          • two-two-two-two-two
            • etc
  • three

List using dashes

  • one
  • two
    • two-one
    • two-two
      • two-two-one
      • two-two-two
        • two-two-two-one
        • two-two-two-two
          • two-two-two-two-one
          • two-two-two-two-two
            • etc
  • three

Ordered list

  1. one
  2. two
    1. two-one
    2. two-two
      1. two-two-one
      2. two-two-two
        1. two-two-two-one
        2. two-two-two-two
          1. two-two-two-two-one
          2. two-two-two-two-two
            1. etc
  3. three

Mixed list

  1. one
  2. two
    • two-one
    • two-two
      1. two-two-one
      2. two-two-two
        • two-two-two-one
        • two-two-two-two
          1. two-two-two-two-one
          2. two-two-two-two-two
            1. etc
  3. three

Automatic hyperlink http://google.com/

Explicit hyperlink Google

Inline verbatim

Verbatim block

This is verbatim

GFM code block

Python

print('hello world')

Javascript

console.log('hello world');

Carroted quote

I heard Bob say

Hello world!

Local images Alternative text

Web images (not supported for non-html templates) Alternative text

Embeded, scrubbed HMTL (not supported for non-html templates)

This should be blue.

Inline latex math $m = \frac{F}{a}$

Latex math block $$m = \frac{F}{a}$$

Stdout

In [1]:
# Python code block
import sys
sys.stdout.write('Stdout')
sys.stdout.flush()
Stdout

Exception

In [2]:
raise Exception('Error')
---------------------------------------------------------------------------
Exception                                 Traceback (most recent call last)
<ipython-input-2-24314b2fb2fb> in <module>()
----> 1 raise Exception('Error')

Exception: Error

Stderr

In [3]:
sys.stderr.write('Stderr')
sys.stderr.flush()
Stderr

Python repr

In [4]:
a = "Repr"
a
Out[4]:
'Repr'

Language magic

In [5]:
%%javascript
console.log('Hello JS console.');

Rich output

In [6]:
from IPython.display import display, HTML, Image, Latex, SVG
In [7]:
display(HTML('<div style="background: blue; color: white; padding: 1em;">This should be blue.</div>'))
This should be blue.

Embeded images

Remote

In [8]:
display(Image(data='http://ipython.org/_static/IPy_header.png'))

Local

In [9]:
display(Image(data='./images/IPython_logo.png'))

Referenced images

Remote (not supported for non-html templates)

In [10]:
display(Image(url='http://ipython.org/_static/IPy_header.png'))

Local

In [11]:
display(Image(url='./images/IPython_logo.png'))
In [12]:
display(Latex(data='Latex math: $m=\\frac{F}{a}$'))
Latex math: $m=\frac{F}{a}$

SVG images

In [13]:
display(SVG(data='./images/python_logo.svg'))
image/svg+xml

Multiple repr support

In [14]:
class ManyRepr(object):
    def _repr_latex_(self):
        return "$L*\\frac{at}{ex}=Math$"
    def _repr_html_(self):
        return "<div style='background: blue; color: white;'>This is blue. HTML</div>"
    def _repr_svg_(self):
        return SVG(data='./images/python_logo.svg').data
    def _repr_png_(self):
        return Image(data='./images/IPython_logo.png').data
    def __repr__(self):
        return 'Text'
ManyRepr()
Out[14]:
This is blue. HTML
This is a raw cell which will not be altered by nbconvert.
This is red. HTML
$L*\\frac{at}{ex}=Math$ Here is some **bold** markdown.

Link to another notebook here.

Link to an image here.