Previous topic

Jup2Jek (jup2jek)

Next topic

jup2jek.Jup2Jek.assets_path

This Page

jup2jek.Jup2Jek

class jup2jek.Jup2Jek(root, options=None)[source]

A class for converting Jupyter notebooks to markdowns for use on Jekyll websites.

Parameters:
root : str

The path to the website root directory.

options : dict

The path to the configuration file. If None, then the default configuration file root/jup2jek.ini will be used.

Examples

The contents of an example configuration file are below:

>>> [JUP2JEK]
>>> posts = _posts
>>> assets = assets/jupyter
posts
The relative path to the posts directory from the website root. This is _posts for default Jekyll site configurations.
assets

The relative path to the assets folder where generated notebook assets will be stored. This is relative to the website root.

Warning

This folder will be cleared each time convert_notebooks() is called. Therefore, the folder should be separate from those used for other website assets. Otherwise those assets will be deleted.

Methods

assets_path(self) Returns the assets path.
convert(self, path) Converts the notebook at the specified path to markdown via the jupyter nbconvert [notebook path] –to markdown command.
convert_notebooks(self) Converts all Jupyter notebooks within the posts folder specified in the class options to markdown for use on Jekyll websites.
load_options(self, path) Loads the options from the specified configuration file.
notebooks(self) Returns a list of notebook paths to be converted.
posts_path(self) Returns the posts path.
write_default_options(path) Writes a configuration file with the default options.