All Projects → danielfrg → mkdocs-jupyter

danielfrg / mkdocs-jupyter

Licence: Apache-2.0 license
Use Jupyter Notebook in mkdocs

Programming Languages

Jupyter Notebook
11667 projects
SCSS
7915 projects
python
139335 projects - #7 most used programming language
CSS
56736 projects
javascript
184084 projects - #8 most used programming language
Jinja
831 projects

Projects that are alternatives of or similar to mkdocs-jupyter

mkdocs-redirects
Open source plugin for Mkdocs page redirects
Stars: ✭ 90 (-47.98%)
Mutual labels:  mkdocs
tutorials
Collection of tutorials for various libraries and technologies
Stars: ✭ 98 (-43.35%)
Mutual labels:  mkdocs
dillinger
The last Markdown editor, ever.
Stars: ✭ 7,533 (+4254.34%)
Mutual labels:  blogging
archivist
A no-nonsense, compile-time blogging engine in pure Elixir
Stars: ✭ 18 (-89.6%)
Mutual labels:  blogging
Phantom
iOS Ghost Client
Stars: ✭ 20 (-88.44%)
Mutual labels:  blogging
Ease
A minimal documentation theme for Ghost
Stars: ✭ 69 (-60.12%)
Mutual labels:  blogging
markdown-fenced-code-tabs
Generates tabs for consecutive markdown code blocks
Stars: ✭ 46 (-73.41%)
Mutual labels:  mkdocs
wtfdocs
The source for https://wtfutil.com
Stars: ✭ 29 (-83.24%)
Mutual labels:  mkdocs
privacyguides.org
Protect your data against global mass surveillance programs.
Stars: ✭ 1,316 (+660.69%)
Mutual labels:  mkdocs
notebook
The collection of all course materials, pull requests are always welcome!
Stars: ✭ 22 (-87.28%)
Mutual labels:  mkdocs
content-o-tron
A process for helping the Rust community and new comers to share their story of using Rust 🤖
Stars: ✭ 18 (-89.6%)
Mutual labels:  blogging
docs
The documentation for Firefly III
Stars: ✭ 30 (-82.66%)
Mutual labels:  mkdocs
markdown-blockdiag
blockdiag extension for Python Markdown
Stars: ✭ 23 (-86.71%)
Mutual labels:  mkdocs
obsidian-publish-mkdocs
A Template to Publish Obsidian/Foam Notes on Github Pages (uses MkDocs)
Stars: ✭ 219 (+26.59%)
Mutual labels:  mkdocs
ImageModels
ImageNet model implemented using the Keras Functional API
Stars: ✭ 63 (-63.58%)
Mutual labels:  mkdocs
mkdocs-table-reader-plugin
MkDocs plugin that adds a {{ read_csv('table.csv') }} markdown tag to directly insert CSV files as a table into a page.
Stars: ✭ 60 (-65.32%)
Mutual labels:  mkdocs
dead-simple-blog
A flat-file, database-free, almost-single-file blog "engine" using PHP.
Stars: ✭ 26 (-84.97%)
Mutual labels:  blogging
mkdocs-jekyll
The Material theme from MkDocs provided as a Jekyll template, optimized for GitHub Pages
Stars: ✭ 55 (-68.21%)
Mutual labels:  mkdocs
howto
Dumping ground for various HowTo documents that I produce
Stars: ✭ 58 (-66.47%)
Mutual labels:  blogging
undefined-ghost-theme
A minimal, Ghost 5.0-ready, membership-enabled starter theme for the Ghost blogging platform.
Stars: ✭ 76 (-56.07%)
Mutual labels:  blogging

mkdocs-jupyter: Use Jupyter Notebooks in mkdocs

  • Add Jupyter Notebooks directly to the mkdocs navigation
  • Support for multiple formats:
  • Same style as regular Jupyter Notebooks
    • Support Jupyter Themes
  • Option to execute the notebook before converting
  • Support for ipywidgets
  • Support for mkdocs TOC
  • Option to include notebook source

mkdocs-jupyter default theme mkdocs-jupyter material theme

Demo website

Visit mkdocs-jupyter.danielfrg.com

Installation

pip install mkdocs-jupyter

Configuration

In the mkdocs.yml use Jupyter notebooks (.ipynb) or Python scripts (.py) as pages:

nav:
- Home: index.md
- Notebook page: notebook.ipynb
- Python file: python_script.py

plugins:
  - mkdocs-jupyter

Titles and Table of Contents

The first h1 header (#) in your notebook will be used as the title.

# This H1 header will be the the title.

This can be turned off in the configuration (in which case the filename will be used as title):

plugins:
  - mkdocs-jupyter:
      ignore_h1_titles: True

In order to see the table of contents you need to maintain a hierarchical headers structure in your notebooks. You must use h2 headers (##) and not h1 (#)

## This H2 title will show in the table of contents

If you want to nest headers in the TOC you need to add additional levels later in the same markdown cell or new bottom markdown cells:

## This header will show as top level in the table of contents

<content>

### This one will be displayed inside the above level

Including or Ignoring Files

You can control which files are included or ignored via lists of glob patterns:

plugins:
  - mkdocs-jupyter:
      include: ["*.ipynb"]  # Default: ["*.py", "*.ipynb"]
      ignore: ["some-irrelevant-files/*.ipynb"]

Execute Notebook

You can tell the plugin to execute the notebook before converting, default is False:

plugins:
  - mkdocs-jupyter:
      execute: True

You can tell the plugin to ignore the execution of some files (with glob matching):

plugins:
  - mkdocs-jupyter:
      execute_ignore: "my-secret-files/*.ipynb"

To fail when notebook execution fails set allow_errors to false:

plugins:
  - mkdocs-jupyter:
      execute: true
      allow_errors: false

Kernel

By default the plugin will use the kernel specified in the notebook to execute it. You can specify a custom kernel name to use for all the notebooks:

plugins:
  - mkdocs-jupyter:
      kernel_name: python3

Ingore Code Input

By default the plugin will show full code and regular cell output details. You can hide cell code input for all the notebooks:

plugins:
  - mkdocs-jupyter:
      show_input: False

You can also decide to hide the Out[#] output notation and other cell metadata for all the notebooks:

plugins:
  - mkdocs-jupyter:
      no_input: True

Jupyter themes

You can configure the different Jupyter themes. For example if using material with slate color scheme you can use the Jupyter Lab dark theme:

plugins:
  - mkdocs-jupyter:
      theme: dark

theme:
  name: material
  palette:
    scheme: slate

Download notebook link

You can tell the plugin to include the notebook source to make it easy to show a download button in the theme, default is False:

plugins:
  - mkdocs-jupyter:
      include_source: True

This setting will also create a page.nb_url value that you can use in your theme to make a link in each page.

For example in mkdocs-material (see customization), you can create a main.html file like this:

{% extends "base.html" %}

{% block content %}
{% if page.nb_url %}
    <a href="{{ page.nb_url }}" title="Download Notebook" class="md-content__button md-icon">
        {% include ".icons/material/download.svg" %}
    </a>
{% endif %}

{{ super() }}
{% endblock content %}

Download Notebook button

Styles

This extensions includes the Jupyter Lab nbconvert CSS styles and does some changes to make it as generic as possible in order for it to work with a variety of mkdocs themes. This is not always possible and the theme we test the most is mkdocs-material.

It's possible you might need to do some CSS changes to make it look as good as you want, for example for the material theme take a look at their customization docs.

Create a main.html file like:

{% extends "base.html" %}

{% block content %}
{{ super() }}

<style>
// Do whatever changes you need here

.jp-RenderedHTMLCommon p {
    color: red
}

</style>
{% endblock content %}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].