Skip to main content

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>

Configuration options

  • output_class what class to use with the output code, by default is notebook_output
  • show_output display output, by default is True, set this if you want to hide the output at all
  • show_label display a label for the output
  • label_text used with show_label set the text for the label for each output

Using the extension

First install with pip: pip install markdown-notebook and then set the extension name in your Python Markdown library, the name of the extension is mdx_notebook.

Release files for markdown-notebook 1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for markdown-notebook 1.0
File Size Uploaded
markdown_notebook-1.0.tar.gz 3.2 kB Details

Release files / markdown_notebook-1.0.tar.gz

Download URL markdown_notebook-1.0.tar.gz
Size 3.2 kB
Tags Source
SHA-256 checksum
How to use checksums
288bcaf1485cf52b3460e3728353985796712fe10be2eab7bef80713d457b517
BLAKE2b-256 checksum
How to use checksums
3e26d1e2eb09f5f20ec77182045494d4f27cfeb7dd2505aba6c7eb9408627fa9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.30.0 CPython/3.7.2

Release history Release notifications | RSS feed

This release

1.0 This release

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page