There Are Several Ways. It Depends on What Exactly Your Blogs Are About. How to Include Jupyter Notebooks in WordPress Posts? One way we already discussed in previously published article – using a WordPress plugin. If that was all purpose way then there would be no reason to publish this article. What exactly you do with your blog? If your blog is serious about data sciences and posts are frequent about snippets and results of Jupyter Notebooks, WordPress Plugin is not sufficient for you.
How to Include Jupyter Notebooks in WordPress Posts?
Plugin is great if works published is not 3-4/day. For heavy works, the works need preservation.
For self hosted WordPress there is matter of security and need of thinks many other matters. Your code, work is asset. For that reason, most basic way you should preserve the work is by converting it to HTML or PDF file with nbconvert tool :
---
1 | https://github.com/jupyter/nbconvert |
You can embed HTML or PDF files within WordPress posts quite easily using different plugins used for that purpose. In that case, with minimum resources you are having the resources “frozen”. This is an example command for Windows :
1 | ipython nbconvert --to html "C:\path\to\your_notebook.ipynb" --stdout > "C:\your\reports\custom_name_file.html" |
OR :
1 | jupyter nbconvert --to html --template basic *source_file.ipynb* *target_file.html* |
Here is documentation :
1 | https://ipython.org/ipython-doc/3/notebook/nbconvert.html |
Jupyter notebook is saved as JSON text file. That JSON file contains everything of the notebook – text, code, and outputs. There are excellent resources like this one :
1 | http://blog.juliusschulz.de/blog/ultimate-ipython-notebook |
For GitHub, actually you should copy that JSON and paste it, save as .ipynb
file, see this gist :
1 | https://gist.githubusercontent.com/AbhishekGhosh/e4c7d1026d9850eae22f2bfd53caf576/raw/c8b7cd448aa1ef2dc9d1be0da03600d6f54d31a6/Periodic-Table.ipynb |
But the file looks like original as Gist :
1 | https://gist.github.com/AbhishekGhosh/e4c7d1026d9850eae22f2bfd53caf576 |
That gist officially can embedded by copy-pasting the script in Github’s field to share :
1 | <script src="https://gist.github.com/AbhishekGhosh/e4c7d1026d9850eae22f2bfd53caf576.js"></script> |
Now, I am copy pasting that without using as code :
Nice, is not it? Only graph part actually useful for non-data science blogs too :
It is also useful way to use MathJax, LaTex for complex equations.
Self hosted Gitlab has equivalent thing, you can see the request :
1 | https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/10017 |
You can use Binder for lot of Notebooks :
1 | https://mybinder.org/ |
The official :
1 | http://nbviewer.jupyter.org/ |
…is a free software :
1 | https://github.com/jupyter/nbviewer |
You may need to install it on your server to handle tons of load. There is tool named Bookstore for OpenStack Swift :
1 | https://github.com/rgbkrk/bookstore |
There are actually many ways. Some easy, some difficult.
Tagged With wordpress jupyter notebook , how to put jupiter notebook into wordpress , How to publish Jupyter Notebook to WordPress Site , how to post Jupyter notebook inwordpress post , how to display jupyter notebook in blogger , how to deploy jupyter on wordpress , embed jupyter wordpress , embed jupyter notebook on own website , embed jupyter notebook in wordpress , create wordpress post from jupyter notebook