Saturday, May 24, 2025

How to add Mermaid.js to Blogger.com with dark theme

  1. Go to Blogger dashboard > Theme > Edit HTML.
  2. Add these lines before </head>. Note: Please go to https://mermaid.js.org/config/usage.html to check the latest usage.
  3. <script src='https://cdn.jsdelivr.net/npm/mermaid@11.6.0/dist/mermaid.min.js'/>
    <script>
      mermaid.initialize({startOnLoad: true, theme: 'dark'});
    </script>
  4. Finally, the example mermaid.js code and diagram will be like below:
  5. <div class="mermaid">
      graph TD;
        A-->B;
        A-->C;
        B-->D;
        C-->D;
    </div>
graph TD; A-->B; A-->C; B-->D; C-->D;

No comments:

Post a Comment