Mermaid diagrams & Javascript handlers

Firstly, thank you for adding Mermaid support, this is amazing.

I was going through the features Mermaid offers, and I noticed the interaction section where they discuss adding Javascript callbacks to nodes in the diagrams.

I created a note with the contents:

var callback = function(){
    alert('A callback was triggered');

graph LR
A --> B
click A callback "Tooltip"

The graph renders, but in the built-in viewer, neither the tooltip nor the callback works. When exported to HTML, the tooltip appears, but the callback does not work.

Furthermore, if I make the handler a redirect, similar to the example (e.g. click A "" "Tooltip"), the rendered note disappears in the built-in viewer when the node is clicked, supposedly because of the redirect. Then, I cannot find an easy way to re-render the note, short of restarting the application. When exported to HTML and opened in a browser, the redirect works as expected.

Am I making a mistake somewhere, or are these things not fully supported yet? If the latter, is this planned to be supported in the future?

We don’t allow running arbitrary JS in notes for security reasons. I believe the Mermaid diagrams run with the default securityLevel='strict'

Alright, makes sense. I thought it would be something along those lines, thanks for clarifying!