Jupyter Markdown Formatting


Here, I present ipymd, a plugin for jupyter that allows to read and write R Notebook format. The package is freely available from github.

This screenshot shows the same notebook, opened with jupyter, vi and the .nb.html file opened in chrome:

You also learned how to change the default type of the cell by clicking in the cell and selecting a new cell type (e.g. Markdown) in the cell type menu in the toolbar.Furthermore, you learned that in a Jupyter Notebook file, you can double-click in any Markdown cell to see the syntax, and then run the cell again to see the Markdown formatting. Note: if you type text in a Markdown cell with no. This line won't.have any markdown. formatting applied. I can even write HTML and it will show up as text. This is great for showing program source code, or HTML or even Markdown. This won't show up as HTML but exactly as you see it in this text file.


Working in Data Science with both R and Python I use both Jupyter notebooks and R Markdown/R Notebooks on a daily basis, depending on the project.

Jupyter Notebooks Markdown Formatting

MarkdownJupyter Markdown Formatting

While I usually prefer to work with Python, I have always been envying the R community for the R markdown format due to the following reasons:

Bold A Word In The Jupyter Markdown

  • As output is separated from the source, it works well under version control
  • The source code can be edited in a text-only editor such as vi.
  • The chunk options of R markdown allow to hide certain parts of the document, or to add figure captions, allowing to generate publication-quality reports.

To obtain the best of two worlds, I implemented R markdown (or should it be called Pymarkdown?) support for jupyter.

When it comes to generating publication quality reports, the R markdown/Pymarkdown documents can be fed into Tom Augspurger’s pystitch to obtain a rendered html or pdf report.

Jupyter Markdown Formatting

How it works

Jupyter Notebook Markdown Formatting

The jupyter plugin is based on rossant/ipymd, an excellent library for converting jupyter notebooks to various formats. ipymd is a python package that converts on-the-fly between the jupyter notebook-format and the R notebook format. Sky go hdmi to tv. It hooks into jupyter as content-manager, automatically performing such a conversion every time jupyter reads or writes a file, which allows to edit the supported formats directly in jupyter.

The classical jupyter ipynb format is a json-based list of cells, which looks roughly like this:

In RMarkdown, source and output are separated into a .Rmd and .nb.html file respectively. The former is plain markdown consisting of code chunks:

The latter is a html file that can readily be viewed in the browser to view the report. All output is contained in this html document and can be read back by ipymd or RStudio.