Linking Mermaid nodes to Tiddlers
Using the callback node interactions from within TiddlyWiki is not straightforward. AFAICT, even if you define a javascript callback function, the onclick
html event doesn’t get bound to the node.
Here is a minimal working – although not very convenient – solution:
\define clickactions()
<$action-navigate $to=<<dom-title>>/>
\end
<$eventcatcher selector=".node" $click=<<clickactions>>>
<$mermaid text="""
flowchart LR
A[Links to Tiddler A] --> B[Links to Tiddler B] --> C[No link]
click A noop "Tiddler A"
click B noop "Tiddler B"
"""/>
</$eventcatcher>
Click events are linked to tiddlers thanks to the click A noop "Tiddler A"
and click B noop "Tiddler B"
lines, where noop
should have been the name of a callback function – here an unused parameter – and "Tiddler A"
is the title of the linked tiddler.
Note that the node label (the text between square brackets) needs not be related to the target of the link (defined with the click
line).
Fred