markdown-notebook

Python markdown extension to render Jupyter output notation


Keywords
text, filter, markdown, html, notebook, jupyter
License
BSD-3-Clause
Install
pip install markdown-notebook==1.0

Documentation

Notebook style markdown extension

If you work with Jupyter notebooks, you will remember they have the concept of inputs and outputs in the notation, an input is something you enter and and output what the compiler or interpreter returns (it is very useful with expression based languages like OCaml or Haskell).

When working in a Jupyter to Notebook extension for Pelican I found problems trying to convert the inputs and outputs to a markdown syntax, so I think this could be useful to represent them in markdown.

This extension adds support for the elements |[]> and |<[] to indicate outputs and inputs respectibly. They will be rendered inside code elements with defined class styles, for example:

|[]> val a: int = 4

Would be rendered as:

<code class="notebook_output">val a: int = 4</code>

You can define a number between the brackets for the style:

|[12]> val a: int = 5

Would be rendered as:

<span class="notebook_output_index">12</span><code class="notebook_output">val a: int = 4</code>

Extension options