D2 is better, but it's not supported by GitHub. Go where your users are.
The actual drawing engine sucks compared to something like Graphviz. Works fine up until a certain number of nodes but completely falls apart after that
Do you want to risk that your diagram changes outside of your control? (i.e. GitHub changes a mermaid version)
[1] https://cursor.com/docs/configuration/tools/mermaid-diagrams