-
-
Notifications
You must be signed in to change notification settings - Fork 6.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
About Markpad integration #323
Comments
It works with mermaid.init(); but is deprecated in favor of mermaidAPI but I can understand how to use it |
I toyed around with your fiddle and made some modifications. First, I include these assets from their live editor:
Then, my HTML looks like this: <textarea name="" id="input" cols="30" rows="10"></textarea>
Preview: <pre id="preview"></pre>
<button type="button" id="render">Render</button>
Output: <div id="output"></div> My CSS: #output, #preview {
color: #000;
} And the JavaScript code: var input = document.getElementById("input");
var preview = document.getElementById("preview");
var output = document.getElementById("output");
var renderBtn = document.getElementById("render");
var config = {
startOnLoad: false,
flowchart: {
useMaxWidth: false,
htmlLabels:true
}
};
render.onclick = function() {
preview.innerHTML = input.value;
// mermaid.initialize(config);
mermaidAPI.render('output', input.value, function(svgCode, bindFunctions) {
console.log("Render", svgCode, bindFunctions);
output.innerHTML = svgCode;
});
} When I enter
and hit the button, I see
|
Working JavaScript part: 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;
});
} Note, that you need to include https://cdn.rawgit.com/knsv/mermaid/0.5.8/dist/mermaidAPI.js instead of mermaid.js! The explanation of https://knsv.github.io/mermaid/#binding-events helped me. |
wowww thanks bro, let me test it :D |
The third argument of |
I supposed it was for something like this |
…yarn/develop/tailwindcss-2.2.9 chore(deps-dev): bump tailwindcss from 2.2.7 to 2.2.9
I'm not clear about Markpad integration, Mermaid seems not to work with key events. I even tried a simpler example by passing the value of a textarea to a div (without Markpad) and still does not work.
https://jsfiddle.net/rLLdgn3v
The text was updated successfully, but these errors were encountered: