-
-
Notifications
You must be signed in to change notification settings - Fork 7k
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
Cannot read property 'replace' of undefined #239
Comments
Small change in the render call:
I noticed the docs was not updated. Will update them. |
Hi @knsv , I thought mermaidAPI.js was generating HTML on server side (aka, node.js). If mermaidAPI.js still depends on DOM (document, innerHTML...etc), what's the advantage of it over mermaid.js ? With mermaid.js, I can do the following which is simpler and more straightforward: <script src="jquery.js"></script>
<script>
$('#graphDiv').text('graph TB\na-->b');
$('#graphDiv').addClass('mermaid');
mermaid.init();
</script> update I just found this todo item: https://github.com/knsv/mermaid/blob/master/src/mermaidAPI.js#L461 I think the point of mermaidAPI.js is: with the graph object, you can decide what to do
Quoted from https://github.com/knsv/mermaid/blob/master/src/mermaidAPI.js#L11 I think the old API is better:
|
The origins of the API was to separate the site integrations from the rendering of diagrams. The idea was to make complex integrations easier and somewhat cleaner and at the same time not inpose more complexity in the original style of integration which was starting to happen. All that said, I have no plans of removing the original integration as in your first example. The two integration style will live on side by side. mermaid.init in tun uses the API for generation the graph so there are no code duplication due to this. |
Understood. I still have two questions:
|
I see what you mean now. I had some issues with asynchronous rendering it was not always ready rendered straight away. This had to do with subgraphs and dagre-d3. That is no longer the case thanks to a new version of dagre-d3. Perhaps a straight forward way would be to return as you propose when no callback is supplied. Easier interface and still backwards compatible. |
Closing issue as it's resolution is included in release 0.5.6. Let me know if you do not agree. |
…yarn/develop/typescript-eslint/eslint-plugin-4.28.1 Bump @typescript-eslint/eslint-plugin from 4.28.0 to 4.28.1
I try the sample code on doc and I got the error : "cannot read property 'replace' of undefined". The error at the line mermaidAPI.render(). How to fix it?
The text was updated successfully, but these errors were encountered: