Skip to content

Instantly share code, notes, and snippets.

@tonyfast
Forked from bollwyvl/WORKING Just a script.ipynb
Last active August 29, 2015 14:17
Show Gist options
  • Save tonyfast/d6cbe7a0b46ced424fc7 to your computer and use it in GitHub Desktop.
Save tonyfast/d6cbe7a0b46ced424fc7 to your computer and use it in GitHub Desktop.
Using Mermaid in Ipython Notebook with Presentation in NBViewer
<!doctype html>
<html>
<head>
</head>
<body>
<iframe src="http://nbviewer.ipython.org/gist/bollwyvl/d5a120156216797c7132" width="600" height="800"></iframe>
</body>
</html>
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "code",
"execution_count": 39,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/html": [
"\n",
"<script src=\"https://cdn.rawgit.com/knsv/mermaid/bc5f73daa2769b666ccf442fa4f6d7fd4995feb0/dist/mermaid.full.js\"></script>"
],
"text/plain": [
"<IPython.core.display.HTML object>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"%%html\n",
"<script src=\"https://cdn.rawgit.com/knsv/mermaid/bc5f73daa2769b666ccf442fa4f6d7fd4995feb0/dist/mermaid.full.js\"></script>"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# This is a Markdown Cell with some embedded [mermaid](https://github.com/knsv/mermaid)\n",
"\n",
"> Wait for the embedded mermaid...\n",
"\n",
"<div class=\"mermaid\">\n",
" graph LR\n",
" A[Square Rect] -- Link text --> B((Circle))\n",
" A --> C(Round Rect)\n",
" B --> D{Rhombus}\n",
" C --> D\n",
"</div>\n",
"\n",
"That was great!"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"This is another markdown cell.\n",
"<div class=\"mermaid\">\n",
" graph TB\n",
" subgraph one\n",
" a1-->a2\n",
" end\n",
" subgraph two\n",
" b1-->b2\n",
" end\n",
" subgraph three\n",
" c1-->c2\n",
" end\n",
" c1-->a2\n",
"</div>"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"This cell must be included somewhere, but the end is fine."
]
},
{
"cell_type": "code",
"execution_count": 42,
"metadata": {
"collapsed": false
},
"outputs": [
{
"data": {
"text/html": [
"<script>$(function(){\n",
" window.mermaid && mermaid.init();\n",
" $(IPython.events).on(\"rendered.MarkdownCell\", function(evt, cell){\n",
" mermaid.init();\n",
" });\n",
"});</script>"
],
"text/plain": [
"<IPython.core.display.HTML object>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"%%html\n",
"<script>$(function(){\n",
" window.mermaid && mermaid.init();\n",
" $(IPython.events).on(\"rendered.MarkdownCell\", function(evt, cell){\n",
" mermaid.init();\n",
" });\n",
"});</script>"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 2",
"language": "python",
"name": "python2"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 2
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython2",
"version": "2.7.3"
}
},
"nbformat": 4,
"nbformat_minor": 0
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment