mermaid is mostly client side rendered in JS, so it's surprising it doesn't have a very well fleshed out API to handle interactivity. Also it's a pain to render to PNGs, you need a full headless browser/puppeteer to run mermaid-cli.
adding links + tooltips: https://jsfiddle.net/s37cjoau/3/
I did an eval of some other options for more dynamic apps including react-flow, cytoscapeJS etc. https://github.com/dcsan/autoapps/issues/1