Mermaid diagrams fail with "Maximum text size exceeded" error - no way to configure maxTextSize limit

Did you follow the troubleshooting guide? [Y/N]

Y - Tested in sandbox vault with no plugins, no CSS snippets, and default theme

Expected result

Either:

  1. The diagram should render regardless of size, OR
  2. There should be a configuration option to increase the maxTextSize limit (similar to how standalone Mermaid.js allows mermaid.initialize({ maxTextSize: 100000 }))

Actual result

The diagram fails to render and displays: “Maximum text size in diagram exceeded”

There is no way to configure or override this limit in Obsidian settings, frontmatter, or through any other means.

Environment

SYSTEM INFO:
Obsidian version: v1.8.10
Installer version: v1.8.4
Operating system: Darwin Kernel Version 23.5.0: Wed May 1 20:09:52 PDT 2024; root:xnu-10063.121.3~5/RELEASE_ARM64_T6020 23.5.0
Login status: logged in
Language: en
Live preview: on
Base theme: adapt to system
Community theme: none
Snippets enabled: 0
Restricted mode: on

Additional information

  • This is a limitation of the built-in Mermaid implementation in Obsidian
  • The Mermaid.js library has a default maxTextSize of 50,000 characters which can be configured in standalone implementations
  • This affects users working with large, complex diagrams for technical documentation
  • Since Mermaid is built into Obsidian (not a plugin), users cannot work around this limitation
  • Other Mermaid limits like maxEdges have been discussed in the forum, but maxTextSize hasn’t been addressed yet

Suggested solution: Add a configuration option in Settings > Editor or allow frontmatter configuration like:

---
mermaid:
  maxTextSize: 1_000_000
---

This seems more like Feature Request than a Bug Report. Please, open one.

I’ve hit similar problems like this before. As you say, there is no way to use mermaid’s initialisation options inside Obsidian. The only solution I found was to use the mermaid live editor and create an SVG or PNG and then include that in the note. A royal pain! At least the mermaid live editor is free.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.