MermaidJS not rendering MathJax

Hello! I’m trying to create a diagram using MermaidJS and i want to use some MathJax with it. If i try to do it using the Live Editor linked in the docs it works. But when i copy the same code to Obsidian the MathJax part is rendered as simple text.

This is the code i’m using:

graph LR
subgraph Domain
A[$$x_1$$]
B[$$x_2$$]
C[$$x_3$$]
end
subgraph Range
D[“f(x1)”]
E[“f(x2)”]
F[“f(x3)”]
end
A → D
B → E
C → F

Any ideas what might be causing this?

never used maths in mermaid but i’d try with the following:

  • double quotes around expressions
  • mehrmaid plugin if i got the spelling right

In general you can’t do code blocks within code blocks, so I’m not sure if its possible to do what you want. For it to work you’d need for the mermaid plugin to render markdown (and mathjax in particular) which I don’t think it does.

mehrmaid apparently does markdown but never tried

Thanks for your suggestion. I tried mehrmaid and it did exactly what i wanted.

1 Like

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