Mermaid ERD diagrams are kinda new and lack any kind of clickable support (at least any that I could find), so to make it work for The Brick gem which is a data-related Ruby on Rails add-on, I found it was possible to create this Javascript object with node names and link destinations:
var links = {
Customer: "/customers/index",
Employee: "/employees/index",
Shipper: "/shippers/index",
OrderDetail: "/order_details/index",
Site: "/sites/index",
User: "/users/index"
};
And then in the Mermaid initializer use this to do addEventListener("click" ...)
on relevant graphics objects inside the Mermaid SVG with this trickery:
mermaid.initialize({
startOnLoad: true,
securityLevel: "loose",
er: { useMaxWidth: false },
mermaid: {callback: function(objId) {
var svg = document.getElementById(objId);
var nodeName;
for(nodeName in links) {
var gErd = svg.getElementById(nodeName);
gErd.addEventListener("click",
function (evt) {
location.href = links[this.id];
}
);
}
}}
});
The result is if you click anywhere inside the node, it navigates. Hopefully something similar is possible in your graphs.