Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

PyPI - Python Version PyPI PyPI - Downloads GitHub contributors PyPI - License

mknotebooks

mknotebooks is a plugin for MkDocs, which makes it more convenient to include Jupyter notebooks in your project documentation.

Install

pip3 install mknotebooks

Usage

Simply include any notebooks you want to use in the docs source directory, and add mknotebooks to the plugin section of your mkdocs.yml as follows:

plugins:
  - mknotebooks

You can optionally execute the notebooks, by setting execute: true in the config, and include a hidden preamble script, to be run before executing any cells using preamble: "<path/to/your/script>". The default cell execution timeout can be overridden by setting timeout: <timeout>, where <timeout> is an integer number of seconds.

By default, execution will be aborted if any of the cells throws an error, but you can set allow_errors: true to continue execution and include the error message in the cell output.

Any static images, plots, etc. will be extracted from the notebook and placed alongside the output HTML.

Styling

Mknotebooks applies default styling to improve the appearance of notebook input/output cells and pandas dataframes. If these interfere with any other CSS stylesheets that you're using, you can disable these via the following options.

# mkdocs.yml
- mknotebooks:
   enable_default_jupyter_cell_styling: false
   enable_default_pandas_dataframe_styling: false

Syntax hightlightting

In order to enable syntax highlighting for code blocks, pygments has to be installed and codehilite extension has to be enabled in mkdocs.yml.

  1. Install pygments:
pip install Pygments
  1. Enable codehilite extension in mkdocs.yml:
markdown_extensions:
    - codehilite

Binder

You can also choose to have mknotebooks insert a Binder link into each notebook.

- mknotebooks:
      binder: true
      binder_service_name: "gh"
      binder_branch: "master"

If you are using GitLab, you will need to set binder_service_name to "gl".

Examples

Example docs projects demonstrating the use of a preamble and Binder are. Try them out by running pipenv install && pipenv run mkdocs serve.

Inspecting generated markdown

You can also export the generated markdown by setting write_markdown: true in your mkdocs.yml. This will write the generated markdown to a .md.tmp file alongside the original notebook.

Metadata

Release files for mknotebooks 0.6.2.post0.dev234

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

Built distribution (wheel)

Table of built distributions (wheels) for mknotebooks 0.6.2.post0.dev234
File Interpreter ABI Platform
mknotebooks-0.6.2.post0.dev234-py3-none-any.whl Python 3 none any Details

Release files / mknotebooks-0.6.2.post0.dev234-py3-none-any.whl

Download URL mknotebooks-0.6.2.post0.dev234-py3-none-any.whl
Size 13.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
65f3fd396265ceb0ab435b4493874dfec593def96183d1e60e694e0ac3db8a13
BLAKE2b-256 checksum
How to use checksums
50c473edd4c823a56d2406ffe485497b4ad1ca6aefc6b9fb4c15913b7f03c98c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/53.0.0 requests-toolbelt/0.9.1 tqdm/4.58.0 CPython/3.7.10

Release history Release notifications | RSS feed

0.8.0

1 release file

0.7.1

1 release file

0.7.0

1 release file

This release

0.6.2

1 release file

0.6.1

1 release file

0.6.0

1 release file

0.5.0

1 release file

0.4.1

1 release file

0.4.0

1 release file

0.3.6

1 release file

0.3.5

1 release file

0.3.4

1 release file

0.3.3

1 release file

0.3.2

1 release file

0.3.1

1 release file

0.3.0

1 release file

0.2.0

1 release file

0.1.16

1 release file

0.1.15

1 release file

0.1.14

1 release file

0.1.13

1 release file

0.1.12

1 release file

0.1.11

1 release file

0.1.10

1 release file

0.1.9

1 release file

0.1.8

1 release file

0.1.7

1 release file

0.1.6

1 release file

0.1.5

1 release file

0.1.4

1 release file

0.1.3

1 release file

0.1.2

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