{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "While `nb-mermaid` will work with any Jupyter kernel, IPython provides a way to capture loading an extension directly in a cell as a `%linemagic`:" ] }, { "cell_type": "code", "execution_count": 4, "metadata": { "collapsed": false }, "outputs": [ { "data": { "application/javascript": [ "// Generated by CoffeeScript 1.9.3\n", "(function() {\n", " require({\n", " paths: {\n", " \"nb-mermaid\": [\"/nbextensions/nb-mermaid/nb-mermaid\", \"https://bollwyvl.github.io/nb-mermaid/nb-mermaid\"]\n", " }\n", " }, [\"nb-mermaid\"], function(nbmermaid) {\n", " console.log(\"nbmermaid loaded\", nbmermaid);\n", " return nbmermaid();\n", " }, function(err) {\n", " return console.log(\"mermaid load error\", err);\n", " });\n", "\n", "}).call(this);\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "%reload_ext mermaid" ] }, { "cell_type": "markdown", "metadata": { "collapsed": true }, "source": [ "
\n", "graph LR\n", " a --> b\n", "
" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "If you take a look at the `ipynb` source, you'll see this embeds a tiny bit of javascript that will first try to hit your server's `nbextensions` directory, but failing that will fall back to the nb-mermaid github repository. This means you can use it to publish on [nbviewer.jupyter.org](http://nbviewer.jupyter.org)." ] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.4.2" } }, "nbformat": 4, "nbformat_minor": 0 }