This page was generated from doc/markdown-cells.ipynb. Interactive online version: Binder badge

Markdown Cells

We can use emphasis, boldface, preformatted text.

It looks like strike-out text is not supported: [STRIKEOUT:strikethrough].
  • Red
  • Green
  • Blue

  1. One
  2. Two
  3. Three

Arbitrary Unicode characters should be supported, e.g. łαßō. Note, however, that this only works if your HTML browser and your LaTeX processor provide the appropriate fonts.

Equations

Equations can be formatted really nicely, either inline, like \(\text{e}^{i\pi} = -1\), or on a separate line, like

\begin{equation} \int_{-\infty}^\infty f(x) \delta(x - x_0) dx = f(x_0) \end{equation}

Note: Avoid leading and trailing spaces around math expressions, otherwise errors like the following will occur when Sphinx is running:

ERROR: Unknown interpreted text role "raw-latex".

See also the pandoc docs:

Anything between two $ characters will be treated as TeX math. The opening $ must have a non-space character immediately to its right, while the closing $ must have a non-space character immediately to its left, and must not be followed immediately by a digit.

Code

We can also write code with nice syntax highlighting:

print("Hello, world!")

Tables

A B A and B
False False False
True False False
False True False
True True True

Images

PNG file (local): Jupyter notebook icon

SVG file (local): Python logo

PNG file (remote): Python logo (remote)

SVG file (remote): Jupyter logo (remote)

HTML Elements (HTML only)

It is allowed to use plain HTML elements within Markdown cells. Those elements are passed through to the HTML output and are ignored for the LaTeX output. Below are a few examples.

HTML5 audio elements can be created like this:

<audio src="https://example.org/audio.ogg" controls>alternative text</audio>

Example:

HTML5 video elements can be created like this:

<video src="https://example.org/video.ogv" controls>alternative text</video>

Example:

The alternative text is shown in browsers that don’t support those elements. The same text is also shown in Sphinx’s LaTeX output.

Note: You can also use local files for the <audio> and <video> elements, but you have to create a link to the source file somewhere, because only then are the local files copied to the HTML output directory! You should do that anyway to make the audio/video file accessible to browsers that don’t support the <audio> and <video> elements.

Info/Warning Boxes

Warning:

This is an experimental feature! Its usage will probably change in the future or it might be removed completely!

Until there is an info/warning extension for Markdown/CommonMark (see this issue), such boxes can be created by using HTML <div> elements like this:

<div class="alert alert-info">

**Note:** This is a note!

</div>

For this to work reliably, you should obey the following guidelines:

  • The class attribute has to be either "alert alert-info" or "alert alert-warning", other values will not be converted correctly.
  • No further attributes are allowed.
  • For compatibility with CommonMark, you should add an empty line between the <div> start tag and the beginning of the content.

Note:

The text can contain further Markdown formatting. It is even possible to have nested boxes:

… but please don’t overuse this!