Intro
I decided to have a little fiddle around with Wordpress by making some custom PHP and CSS for the first time. The outcome is a neat little shortcode plugin for Wordpress that uses Jupyter Nbviewer to create your ipynb and add it to your blog. My next step is to get this onto the Wordpress Plugins so that its properly documented, versioned and available for use by the Wordpress community.
Shortcode’s +/-’s
- Very easy to use
- Your code can be version controlled and updated without having to log into your blog and edit the raw HTML
- Other people can work on the code, for example contributors to your GitHub page
- Very easy to create a easy to navigate Documentation page by using Wordpress and nbconvert
- No iframes! Which many people have suggested...
- Other people can change the notebooks (It's a blessing and a curse!)
- Dependant on nbviewer's servers (However if you wish the code is open source so you can host your own server!)
- Could potentially be slower to render as each time a user requests your page it will have to send requests to nbviewer.
- CSS that is included in the Notebook can overwrite the blog pages CSS (try using this URL https://github.com/plotly/python-user-guide/blob/master/s3_bubble-charts/s3_bubble-charts.ipynb)
How to use the shortcode
Step 1: Add my custom CSS (view by clicking on the button below) into Appearance -> Customize -> Additonal CSS Step 2: In the the Wordpress post editor simply enter the shortcode with the url to where the ipynb file is hosted. For example see Example 1 where we render a notebook that is stored on Folium's GitHub page.
|
|
Example 1
|
|
Example 2
Heres another example, the shortcode in this case being:
|
|