I also ran into massive issues trying to use Mermaid when I tried to pair it up with Marp (markdown for presentations). I am not sure if it is Mermaid's fault or Marp's fault but it didn't work and tons of people want it to work:
https://github.com/orgs/marp-team/discussions/207
The discussion seems to make it pretty clear where the issues are, though, and how you can get around them using mermaid's render to svg.
The discussion seems to make it pretty clear where the issues are, though, and how you can get around them using mermaid's render to svg.