Search code examples
graphmarkdownmermaid

How to generate arbitrally large mermaid diagram in local? Error: "Maximum text size diagram exceeded"


I have a bunch of data from which i'm generating a text file to encode a mermaid diagram. But since this text file so big: 2000 lines. It won't generate an svg on the live version of https://mermaid.live/edit. I then tried to install the mermaid http-server using docker, with no success (https://github.com/TomWright/mermaid-server). Then, I wanted to try to use a local client but I have the same error: "Maximum text size diagram exceeded". (https://github.com/mermaid-js/mermaid-cli) So the prblem is that I can't generate an SVG file from my data.

I try to check if there were a configuration file in any of those mermaid "implementations" but i couldn't find one. I checked previously asked similar questions on Stackoverflow, but they are outdated unfortunatly.


Solution

  • So by using this template and pasting the graph text inside the "mermaid" beacons: it works because the maxTextSize has been set to 10000000000. `

    <!DOCTYPE html>
    <html lang="en">
      <head>
        <meta charset="utf-8" />
      </head>
      <body>
        <pre class="mermaid">
        ...
        ...
        </pre>
        <script type="module">
          import mermaid from 'https://cdn.jsdelivr.net/npm/mermaid@9/dist/mermaid.esm.min.mjs';
          mermaid.initialize({ startOnLoad: true, securityLevel: 'loose', maxTextSize: 10000000000,});
        </script>
      </body>
    </html>
    

    `