Fix for issue #311, mermaid will clear div used for rendering initially in the redner function.

This commit is contained in:
Knut Sveidqvist 2016-12-14 12:40:44 +01:00
parent 66d7c00e84
commit a179212c60
1 changed files with 40 additions and 0 deletions

View File

@ -0,0 +1,40 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<script src="http://code.jquery.com/jquery-1.11.3.min.js"></script>
<link rel="stylesheet" href="../../dist/mermaid.css"/>
<script src="dist/mermaidAPI.js"></script>
<script>
mermaidAPI.initialize({
startOnLoad: false,
logLevel: 1
});
$(function(){
// Example of using the API
var insertSvg = function(svgCode, bindFunctions){
// Rendering is completed so something with the svgCode
var element = document.querySelector("#resDiv");
element.innerHTML = svgCode;
};
var graphDefinition = 'graph TB\na-->b';
var graphDefinition2 = 'graph TB\nc-->d';
var element = document.querySelector("#resDiv");
var graph = mermaidAPI.render( 'graphDiv', graphDefinition, insertSvg, element);
element = document.querySelector("#resDiv");
graph = mermaidAPI.render( 'graphDiv', graphDefinition2, insertSvg, element);
});
</script>
</head>
<body>
<div id="resDiv"></div>
</body>
</html>