mermaid: Invalid value for attribute viewBox="0 0 -Infinity -Infinity"

Using the Jekyll plugin and getting the above error. Also get the error when calling mermaid.init();

The svg looks like:

<svg id="mermaidChart1" xmlns="http://www.w3.org/2000/svg" height="100%" viewBox="0 0 -Infinity -Infinity" style="max-width:-Infinitypx;"><g><g class="output"><g class="clusters"></g><g class="edgePaths"></g><g class="edgeLabels"></g><g class="nodes"></g></g></g></svg>

for the example:

graph TD;
    A-->B;
    A-->C;
    B-->D;
    C-->D;

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Reactions: 5
  • Comments: 16 (1 by maintainers)

Commits related to this issue

Most upvoted comments

The problem is with calling init. If you dont call it like this…

  var config = {
        startOnLoad: false
    };
    mermaid.initialize(config);

then the startOnLoad defaults to True. The page may have no graph/chart text info yet, and this makes the svg error happen.

Actually, I think I figure it out, this error happens when you try to use mermaid.init() in a div with class “mermaid” and this div is empty, without the graph definition. I tested it in all versions above 4.0, including 4.0 and they all have this problem, although the version in the ‘editor’ folder, which I believe is an much older one, works fine.