Javascript library in a notebook: mermaid

Tries mermaid in a notebook. Example from demo.

In [1]:
from jyquickhelper import RenderJS
css = ["http://www.xavierdupre.fr/js/mermaid/mermaid.forest.css"]
libs = ['http://www.xavierdupre.fr/js/mermaid/mermaidAPI.min.js']
script = """
var graphDefinition = 'graph TB\\na-->b';
var cb = function(svgGraph) {
    document.getElementById('__ID__').innerHTML = svgGraph;
}
mermaidAPI.render('__ID__svg', graphDefinition, cb);
"""
jr = RenderJS(script, css=css, libs=libs)
jr
Out[1]:
In [2]:
print(jr._repr_html_())
<div id="M7c5b0090833f4cf588f8bbc544beb97f-css"><link rel="stylesheet" href="http://www.xavierdupre.fr/js/mermaid/mermaid.forest.css" type="text/css" /><div id="M7c5b0090833f4cf588f8bbc544beb97f" style="height:100%;width:100%;"></div></div>
<script>

require(['http://www.xavierdupre.fr/js/mermaid/mermaidAPI.min.js'], function() { 
var graphDefinition = 'graph TB\na-->b';
var cb = function(svgGraph) {
    document.getElementById('M7c5b0090833f4cf588f8bbc544beb97f').innerHTML = svgGraph;
}
mermaidAPI.render('M7c5b0090833f4cf588f8bbc544beb97fsvg', graphDefinition, cb);
 });

</script>

In [3]: