It is extremely difficult work to include Jupyter Notebooks within WordPress posts. Recently, One Clever WordPress Plugin to Include Jupyter Notebooks in Posts Pages Developed, Which May Help Many Who Publishes Data Science Related Blog Posts. We have not tested yet, partially because we are currently testing compatibility of various software with new release of Ubuntu LTS. You can see our Percona MySQL and Apache2 guides for Ubuntu 18 LTS to have some sympathy for giving a clause of not testing but publishing an article. We noticed the plugin and thought to let others know about it. Also, it will work as self-reminder.
WordPress Plugin to Include Jupyter Notebooks
Earlier we published article on how to install WordPress Plugin, Themes from Github. That is, via a WordPress plugin named WP Pusher. To use the plugin we are talking about, you’ll need that plugin to be installed too.
Here is the official repository of the WordPress plugin :
---
1 | https://github.com/ghandic/nbconvert |
The code from the plugin talk about the clever trick :
1 2 3 4 5 6 7 8 9 10 11 | ... function nbconvert_function($atts) { //process plugin extract(shortcode_atts(array( 'url' => "", ), $atts)); $clean_url = preg_replace('#^https?://#', '', rtrim($url,'/')); $html = file_get_contents("https://nbviewer.jupyter.org/url/" . $clean_url); $nb_output = getHTMLByID('notebook-container', $html); $last_update_date_time = get_most_recent_git_change_for_file_from_api($url); ... |
Actually, unlike before we had to use Nbviewer :
1 | http://nbviewer.jupyter.org/github/jrjohansson/qutip-lectures/blob/master/Lecture-16-Gallery-of-Wigner-functions.ipynb |
Github itself can render Jupyter Notebooks :
1 | https://github.com/jrjohansson/qutip-lectures/blob/master/Lecture-16-Gallery-of-Wigner-functions.ipynb |
The difference also discussed on Github’s documentation :
1 | https://help.github.com/articles/working-with-jupyter-notebook-files-on-github/ |
If you look at my this FAQ :
1 | http://nbviewer.jupyter.org/faq#can-i-access-notebook-viewer-over-https |
They are saying – “If you need to embed an html notebook on another site, please use local export with nbconvert.”
That simply can mean, Rackspace has set a limit of number of GET requests from one domain.
In simple word, if your article has huge traffic and it pulls others server too much, you probably should self host all parts – Gitlab to nbviewer. It is not fully safe to rely on matters which are part of the post. Like, we paste part of snippet and also publish on Github.
The plugin definitely great, specially for the medium traffic websites. In last 2 decades we saw many free web services to get discontinued.
Tagged With installing jupyter nbviewer on wordpress , jupyter notebook file wordpress , jupyter notebook plugin , jupyter wordpress , nbviewer to your wordpress blog , wordpress iot ju , wordpress notebook plugin , wordpress plugin jupyter