Skip to content

anemes/pelican-ipythonnb

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

44 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Pelican plugin for blogging with iPython Notebooks

This fork of the original pelican-ipythonnb makes two small modifications to the output HTML:

  1. All input code cells are hidden by default, and the in interpreter In [1] text toggles their visiblity.
  2. Any code cells that begin with #HIDE are removed from the output all together. This allows the use of code blocks that won't be visible in the static website.

Works with

This has been tested only on the default theme notmyidea and notmyidea-cms.

Requirements

  • pelican==3.3
  • ipython==1.1.0
  • bs4==4.3.2

Also some libraries are used by IPython.nbconvert:

I recommend Python 3 because all the libraries already support it and is the main target of this plugin, python 2.7 should work in any case.

Installation

Put the plugin (__init__.py and ipythonnb.py) inside pelican_project/other_plugins/ipythonnb folder.

Then in the pelicanconf.py:

MARKUP = ('md', 'ipynb')

PLUGIN_PATH = './other_plugins'
PLUGINS = ['ipythonnb']

If you host your site on github pages (or just git) you could use it as a submodule:

git submodule add git://github.com/danielfrg/pelican-ipythonnb.git plugins/ipythonnb

How to use it

Option 1 (recomended)

Write the post using the iPython notebook interface, using markdown, equations, etc.

Place the .ipynb file in the content folder and create a new file with the same name as the ipython notebook with extention .ipynb-meta. So you should have: my_post.ipynb and my_post.ipynb-meta

The ipynb-meta should have the regular markdown metadata:

Title:
Slug:
Date:
Category:
Tags:
Author:
Summary:

Note the empty line at the end, you need that.

Option 2

Open the .ipynb file in a text editor and should see.

{
    "metadata": {
        "name": "Super iPython NB"
    },
{ A_LOT_OF_OTHER_STUFF }

Add the metadata in the metadata field like this:

{
 "metadata": {
        "name": "Super iPython NB",
        "Title": "Blogging with iPython notebooks in pelican",
        "Date": "2013-2-16",
        "Category": "Category",
        "Tags": "tag2, tag2",
        "slug": "slug-slug-slug",
        "Author": "Me"
    },
    { A_LOT_OF_OTHER_STUFF }

About

Pelican plugin for blogging with iPython Notebooks

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%