Inspired by mermaid-js/mermaid#323 of a friend of mine.
Created
March 13, 2019 02:19
-
-
Save mctouch/e4846c003488cd3198243699619d6a94 to your computer and use it in GitHub Desktop.
Mermaid Demo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div> | |
This Pen makes use of | |
<a href="https://knsv.github.io/mermaid" target="_blank">mermaid.js</a> to describe diagrams like a <a href="https://en.wikipedia.org/wiki/Gantt_chart" target="_blank">Gantt</a> with Markdown. The example code is taken from <a href="https://knsv.github.io/mermaid/live_editor/" target="_blank">their live editor</a>. | |
</div> | |
<div> | |
<textarea name="" id="input" cols="30" rows="10"> | |
sequenceDiagram | |
A->> B: Query | |
B->> C: Forward query | |
Note right of C: Thinking... | |
C->> B: Response | |
B->> A: Forward response | |
</textarea> | |
</div> | |
<div> | |
Your code (for debugging): <pre id="preview"></pre> | |
</div> | |
<div> | |
<button type="button" id="render">Render</button> | |
</div> | |
<div>Graph: | |
<div id="output"></div> | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var input = document.getElementById("input"); | |
var preview = document.getElementById("preview"); | |
var output = document.getElementById("output"); | |
var renderBtn = document.getElementById("render"); | |
mermaidAPI.initialize({startOnLoad: false}); | |
render.onclick = function() { | |
preview.innerHTML = input.value; | |
mermaidAPI.render('theGraph', input.value, function(svgCode) { | |
output.innerHTML = svgCode; | |
}); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script src="https://cdn.rawgit.com/knsv/mermaid/0.5.8/dist/mermaidAPI.js"></script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
* { | |
color: #000; | |
background: #fff; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<link href="https://knsv.github.io/mermaid/css/mermaid.css" rel="stylesheet" /> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment